Материал: m912201e

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам

The IEC Operators 299

Selection Operators

12.5.3MIN

Minimum function. Returns the lesser of the two values.

OUT := MIN(IN0, IN1)

IN0, IN1 and OUT can be any type of variable.

Example in IL:

LD

90

MIN

30

MIN

40

MIN

77

ST

Var1 (* Result is 30 *)

Example in ST:

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

Var1:=MIN(MIN(90,30),40); (* Result is 30 *);

Example in FBD:

12.5.4LIMIT

Limiting

OUT := LIMIT(Min, IN, Max) means:

OUT := MIN (MAX (IN, Min), Max)

Max is the upper and Min the lower limit for the result. Should the value IN exceed the upper limit Max, LIMIT will return Max. Should IN fall below Min, the result will be Min.

IN and OUT can be any type of variable.

Example in IL:

LD 90

LIMIT 30,80

ST

Var1 (*Result is 80 *)

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

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

The IEC Operators

303

Address Operators

 

 

 

Example in ST:

VAR1 := 40 = 40;

Example in FBD:

12.6.6NE

Not equal to

A Boolean operator that returns that value TRUE when the operands are not 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

NE

40

ST

Var1 (* Result is FALSE *)

Example in ST:

VAR1 := 40 <> 40;

Example in FBD:

12.7 Address Operators

12.7.1ADR

Address Function

ADR returns the address of its argument in a DWORD. This address can be sent to manufacturing functions to be treated as a pointer or it can be assigned to a pointer within the project.

Example in IL:

LD Var1

ADR

ST Var2

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