Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
21
Добавлен:
11.10.2020
Размер:
3.39 Mб
Скачать

300 The IEC Operators

Comparison Operators

Example in ST:

Var1:=LIMIT(30,90,80); (* Result is 80 *);

12.5.5MUX

Multiplexer

OUT := MUX(K, IN0,...,INn) means:

OUT := INK.

IN0, ...,INn and OUT can be any type of variable. K must be BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT or UDINT. MUX selects the Kth value from among a group of values.

Example in IL:

LD 0

MUX 30,40,50,60,70,80

ST

Var1 (*Result is 30 *)

Example in ST:

Var1:=MUX(0,30,40,50,60,70,80); (* Result is 30 *);

Note:

Note that an expression occurring ahead of an input other than INK will not be processed to save run time ! Only in simulation mode all expressions will be executed.

12.6 Comparison Operators

12.6.1GT

Greater than

A Boolean operator which returns the value TRUE when the value of the first operand is greater than that of the second. The operands can be BOOL, BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT, REAL, TIME, DATE, TIME_OF_DAY, DATE_AND_TIME and STRING.

Example in IL:

LD 20

GT 30

ST

Var1 (* Result is FALSE *)

Example in ST:

WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32

The IEC Operators 301

Comparison Operators

VAR1 := 20 > 30 > 40 > 50 > 60 > 70;

Example in FBD:

12.6.2LT

Less than

A Boolean operator that returns the value TRUE when the value of the first operand is less than that of the second. The operands can be BOOL, BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT, REAL, TIME, DATE, TIME_OF_DAY, DATE_AND_TIME and STRING.

Example in IL:

LD

20

LT

30

ST

Var1 (* Result is TRUE *)

Example in ST:

VAR1 := 20 < 30;

Example in FBD:

12.6.3LE

Less than or equal to

A Boolean operator that returns the value TRUE when the value of the first operand is less than or equal to that of the second. The operands can be BOOL, BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT, REAL, TIME, DATE, TIME_OF_DAY, DATE_AND_TIME and STRING.

Example in IL:

LD 20

LE 30

ST

Var1 (* Result is TRUE *)

Example in ST:

WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32

302 The IEC Operators

Comparison Operators

VAR1 := 20 <= 30;

Example in FBD

12.6.4GE

Greater than or equal to

A Boolean operator that returns the value TRUE when the value of the first operand is greater than or equal to that of the second. The operands can be BOOL, BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT, REAL, TIME, DATE, TIME_OF_DAY, DATE_AND_TIME and STRING.

Example in IL:

LD

60

GE

40

ST

Var1 (* Result is TRUE *)

Example in ST:

VAR1 := 60 >= 40;

Example in FBD:

12.6.5EQ

Equal to

A Boolean operator that returns the value TRUE when the operands are equal. The operands can be BOOL, BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT, REAL, TIME, DATE, TIME_OF_DAY, DATE_AND_TIME and STRING.

Example in IL:

LD 40

EQ 40

ST

Var1 (* Result is TRUE *)

WAGO-I/O-SYSTEM 759 WAGO-I/O-PRO 32

Соседние файлы в папке 759-332