Overview IEC Operators
The table shown below shows the operators in ST and IL with the available modifiers in IL.
Take note that for the 'IL operator' column: Only the line in which the operator is used will be displayed. A prerequisite is that the (first) required operand have been successfully loaded in the preceding line (e.g. LD in). The 'Mod. IL' column shows the possible modifiers in IL:
C |
The command is only executed if the result of the preceding expression is TRUE. |
N |
for JMPC, CALC, RETC: The command is only executed if the result of the preceding expression is FALSE. |
N |
otherwise: negation of the operand (not of the accumulator) |
( |
Operator enclosed in brackets: only after the closing bracket is reached will the operation preceding the brackets be carried out. |
Please obtain a detailed description of usage from the Appendix.
Operator ST |
Operator AWL |
Mod. AWL |
Signification |
---|---|---|---|
' |
|
|
String delimiters (e.g. 'string1') |
[..] |
|
|
Size of Array range (e.g. ARRAY[0..3] OF INT) |
: |
|
|
Delimiter between Operand and Typ in a declaration (e.g. var1 : INT;) |
; |
|
|
Termination of instruction (e.g. a:=var1;) |
^ |
|
|
Derefereced Pointer (e.g. pointer1^) |
|
LD var1 |
N |
Load value of var1 in buffer |
:= |
ST var1 |
N |
Store actual result to var1 |
|
S boolvar |
|
Set boolean operand boolvar exactly then to TRUE, when the actual result is TRUE |
|
R boolvar |
|
Set boolean operand boolvar exactly then to FALSE, when the actual result is TRUE |
|
JMP marke |
CN |
Jump to label |
<Programmname> |
CAL prog1 |
CN |
Call program prog1 |
<Instanzname> |
CAL inst1 |
CN |
Call function block instance inst1 |
<Fktname>(vx,vy,..) |
<Fktname> vx,vy,.. |
CN |
Call function fctname and transmit variables vx, vy |
RETURN |
RET |
CN |
Leave POU and go back to caller |
|
( |
|
The value following the bracket is handled as operand, the operation before the bracket is not executed before the expression in the brackets. |
|
) |
|
Now execute the operation which has been set back |
AND |
AND |
N, ( |
Bitwise AND |
OR |
OR |
N, ( |
Bitwise OR |
XOR |
XOR |
N, ( |
Bitwise exclusive OR |
NOT |
NOT |
|
Bitwise NOT |
+ |
ADD |
( |
Addition |
- |
SUB |
( |
Subtraction |
* |
MUL |
( |
Multiplication |
/ |
DIV |
( |
Division |
> |
GT |
( |
Greater than |
>= |
GE |
( |
Greater or equal |
= |
EQ |
( |
Equal |
< |
LT |
( |
Less than |
<> |
NE |
( |
Not equal |
<= |
LE |
( |
Less or equal |
in1 MOD in2 |
MOD |
|
Modulo Division |
INDEXOF(in) |
INDEXOF |
|
Internal index of POU in1; [INT] |
SIZEOF(in) |
SIZEOF |
|
Number of bytes required for the given data type of in |
SHL(in,K) |
SHL |
|
Bitwise left-shift of operator in by K |
SHR(in,K) |
SHR |
|
Bitwise right-shift of operator in by K |
ROL(in,K) |
ROL |
|
Bitwise rotation to the left of operator in by K |
ROR(in,K) |
ROR |
|
Bitwise rotation to the right of operator in by K |
SEL(G,in0,in1) |
SEL |
|
Binary selection between 2 operands in0 (G is FALSE) and in1 (G is TRUE) |
MAX(in0,in1) |
MAX |
|
Returns the greater of 2 values |
MIN(in0,in1) |
MIN |
|
Returns the lesser of 2 values in0 and in1 |
LIMIT(Min,in,Max) |
LIMIT |
|
Limits the value range (in is set back to MIN or MAX in case of exceeding the range) |
MUX(K, in0,.. in_n) |
MUX |
|
Selects the Kth value out of a group of values (in0 to In_n) |
ADR(in) |
ADR |
|
Address of the operand in [DWORD] |
BOOL_TO_<type>(in) |
BOOL_TO_<type> |
|
Type conversion of the boolean operand |
<type>_TO_BOOL(in) |
<type>_TO_BOOL |
|
Type conversion to BOOL |
INT_TO_<type>(in) |
INT_TO_<type> |
|
Type conversion of an INT Operand to another elementary type |
REAL_TO_<type>(in) |
REAL_TO_<type> |
|
Type conversion of an REAL operand to another elementary type |
LREAL_TO_<type>(in) |
LREAL_TO_<type> |
|
Type conversion of a LREAL operand to another elementary type |
TIME_TO_<type>(in) |
TIME_TO_<type> |
|
Type conversion of a TIME operand to another elementary type |
TOD_TO_<type>(in) |
TOD_TO_<type> |
|
Type conversion of a TOD operand to another elementary type |
DATE_TO_<type>(in) |
DATE_TO_<type> |
|
Type conversion of a DATE operand to another elementary type |
DT_TO_<type>(in) |
DT_TO_<type> |
|
Type conversion of a DT operand to another elementary type |
STRING_TO_<type>(in) |
STRING_TO_<type> |
|
Type conversion of a STRING operand to another elementary type |
TRUNC(in) |
TRUNC |
|
Conversion from REAL to INT |
ABS(in) |
ABS |
|
Absolut value of operand in |
SQRT(in) |
SQRT |
|
Square root of operand in |
LN(in) |
LN |
|
Natural logarithm of operand in |
LOG(in) |
LOG |
|
Logarithm of operand in, base 10 |
EXP(in) |
EXP |
|
Exponential function of operand in |
SIN(in) |
SIN |
|
Sine of operand in |
COS(IN) |
COS |
|
Cosine of operand in |
TAN(in) |
TAN |
|
Tangent of operand in |
ASIN(in) |
ASIN |
|
Arc sine of operand in |
ACOS(in) |
ACOS |
|
Arc cosine of operand in |
ATAN(in) |
ATAN |
|
Arc tangent of operand in |
EXPT(in,expt) |
EXPT expt |
|
Exponentation of operand in with expt |
LEN(in) |
LEN |
|
String length of operand in |
LEFT(str, size) |
LEFT |
|
Left inital string of given size of string str standard.lib |
RIGHT(str, size) |
RIGHT |
|
Right initial string of given size of string str standard.lib |
MID(str, len, pos) |
MID |
|
Partial string of str of given length |
CONCAT(str1, str2) |
CONCAT |
|
Concatenation of two subsequent strings standard.lib |
INSERT(str1, str2, pos) |
INSERT |
|
Insert string str1 in String str2 at position pos standard.lib |
DELETE(str1, len, pos) |
DELETE |
|
Delete partial string (length len), start at position pos of str1 standard.lib |
REPLACE(str1, str2, len, pos) |
REPLACE |
|
Replace partial string of lenght len by str2, start at position pos of str1 |
FIND(str1, str2) |
FIND |
|
Search for partial string str2 in str1 |
SR |
SR |
|
Bistable FB is set dominant |
RS |
RS |
|
Bistable FB is set back |
SEMA |
SEMA |
|
FB: Software Semaphor (interruptable) |
R_TRIG |
R_TRIG |
|
FB: rising edge is detected |
F_TRIG |
F_TRIG |
|
FB: falling edge is detected |
CTU |
CTU |
|
FB: Counts up |
CTD |
CTD |
|
FB: Counts down |
CTUD |
CTUD |
|
FB: Counts up and down |
TP |
TP |
|
FB: trigger |
TON |
TON |
|
FB: on-delay timer |
TOF |
TOF |
|
FB: off-delay timer |