Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
(EOD).Mechatronics.pdf
Скачиваний:
81
Добавлен:
23.08.2013
Размер:
5.07 Mб
Скачать

page 421

 

 

 

FRD

 

 

 

 

Source A D9:0

 

 

 

 

 

 

 

Dest. N7:0

 

 

 

 

 

 

 

 

 

 

 

 

 

TOD

 

 

 

 

Source A N7:1

 

 

 

 

 

 

 

Dest. D9:1

 

 

 

 

 

 

 

 

 

 

 

 

 

DEG

 

 

 

 

Source A F8:0

 

 

 

 

 

 

 

Dest. F8:2

 

 

 

 

 

 

 

 

 

 

 

 

 

RAD

 

 

 

 

Source A F8:1

 

 

 

 

 

 

 

Dest. F8:3

 

 

 

 

 

 

Addr.

before

after

N7:0

0000000000000000

 

0000011100000001

N7:1

0000001000100100

 

0000001000100100

F8:0

3.141

 

3.141

 

F8:1

45

 

45

 

F8:2

0

 

180

 

F8:3

0

 

0.785

 

D9:0

0000 0000 0000 0000

0000 0101 0100 1000

D9:1

0001 0111 1001 0011

0001 0111 1001 0011

24.2.2 Logical Functions

24.2.2.1 - Comparison of Values

These functions act like input contacts. The equivalent to these functions are if-then statements in traditional programming languages.

Basic comparison functions in a PLC-5 include,

CMP(expression) - compares two values for equality EQU(value,value) - equal

page 422

NEQ(value,value) - not equal

LES(value,value) - less than

LEQ(value,value) - less than or equal

GRT(value,value) - greater than

GEQ(value,value) - greater than or equal

• The comparison function below compares values at locations A and B. If they are not equal, the output is true. The use of the other comparison functions is identical.

 

 

 

 

 

O:012

 

 

NEQ

 

 

 

 

 

 

 

 

 

 

A N7:03

 

 

 

 

 

 

 

 

 

 

 

 

B N7:02

 

 

04

 

 

 

 

 

O:012

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

CMP

 

 

 

 

 

 

OR

 

expression

 

 

 

 

 

 

 

 

 

N7:03 <> N7:02

 

04

 

 

 

 

 

 

 

 

 

 

 

 

 

 

More advanced comparison functions in a PLC-5 include, MEQ(value,mask,threshold) - compare for equality using a mask LIM(low limit,value,high limit) - check for a value between limits

Examples of these functions are shown below.

page 423

LIM

low limit N7:0 test value N7:1 high limit N7:2

LIM

low limit N7:2 test value N7:1 high limit N7:0

LIM

low limit N7:2 test value N7:3 high limit N7:0

MEQ source N7:0 mask N7:1

compare N7:2

Addr. after (decimal)

N7:0 1

N7:1 5

N7:2 11

N7:3 15

N7:4

N7:4/0

N7:4/1

N7:4/2

N7:4/3

after (binary)

0000000000000001

0000000000000101

0000000000001011

0000000000001111

0000000000001101

24.2.2.2 - Binary Functions

These functions allow Boolean operations on numbers and values in the PLC memory.

Binary functions are also available for,

AND(value,value,destination) - Binary and function

OR(value,value,destination) - Binary or function

NOT(value,value,destination) - Binary not function

XOR(value,value,destination) - Binary exclusive or function

Соседние файлы в предмете Электротехника