Overview Operators and Library Elements¶
The table shown below shows an overview on the operators, which are available in IEC 61131-3 editor or in the libraries Standard.lib and Util.lib. You find there the notation for ST and IL. For IL also the supported modificators are listed.
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).
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 appropriate appendices concerning IEC operators.
Operators \ in IEC 61131-3 editor:
in ST | in AWL | Mod. AWL |
Description |
---|---|---|---|
‘ | String delimiters (e.g. ‘string1’) | ||
.. [ ] | Size of Array range (e.g. ARRAY[0..3] OF INT) | ||
: | Delimiter between Operand and Type in a declaration (e.g. var1 : INT;) | ||
; | Termination of instruction (e.g. a:=var1;) | ||
^ | Dereferenced 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 |
in ST | in AWL | Mod. AWL |
Description |
---|---|---|---|
JMP label | CN | Jump to label | |
<Program name> | CAL prog1 | CN | Call program prog1 |
<Instance name> | CAL inst1 | CN | Call function block instance inst1 |
<Fctname>(vx, vy,..) | <Fctname> 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 | Bitweise NOT | |
ADD | ( | Addition | |
- | SUB | ( | Subtraction |
* | MUL | ( | Multiplication |
/ | DIV | ( | Division |
> | GT | ( | Greater than |
>= | GE | ( | Greater or equal |
= | EQ | ( | Equal |
<> | NE | ( | Not equal |
<= | LE | ( | Less or equal |
< | LT | ( | Less than |
MOD(in) | 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(K,in) | SHL | Bitwise left-shift of operator in by K | |
SHR(K,in) | SHR | Bitwise right-shift of operator in by K | |
ROL(K,in) | ROL | Bitwise rotation to the left of operator in by K | |
ROR(K,in) | 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) |
in ST | in AWL | Mod. AWL |
Description |
---|---|---|---|
MUX(K,in0,…in_n) | MUX | Selecti the Kth value out of a group of values (in0 to In_n) | |
ADR(in) | ADR | Address of the operand in [DWORD] | |
ADRINST() | ADRINST() | Address of the function block instance from which you are calling that operator. | |
BITADR(in) | BITADR | Bitoffset 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, in must contain valid value of desired type | |
TRUNC(in) | TRUNC | Conversion from REAL to INT | |
ABS(in) | ABS | Absolute 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 |
Elements \ of the Standard.lib
in ST | in AWL | Description |
---|---|---|
LEN(in) | LEN | String length of operand in |
LEFT(str,size) | LEFT | Left inital string of given size of string str |
RIGHT(str,size) | RIGHT | Right initial string of given size of string str |
MID(str,size,pos) | MID | Partial string of str of given size at position pos |
CONCAT(‘str1’,’str2’) | CONCAT ‘str2’ | Concatenation of two subsequent strings |
INSERT(‘str1’,’str2’,pos) | INSERT ‘str2’,p | Insert string str1 in String str2 at position pos |
DELETE(‘str1’,len,pos) | DELETE len,pos | Delete partial string (length len), start at position pos of str1 |
REPLACE(‘str1’,’str2’,len,pos) | REPLACE ‘str2’,len,pos | Replace partial string of lenght len by str2, start at position pos of str1 |
FIND(‘str1’,’str2’) | FIND ‘str2’ | 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 upv |
CTD | CTD | FB: Counts down |
CTUD | CTUD | FB: Counts up and down |
TP | TP | FB: trigger |
TON | TON | FB: Timer On-Delay |
TOF | TOF | FB: Timer Off-Delay |
RTC | RTC | FB: Real Time Clock |
Elements \ of the Util.lib
Element | Description |
---|---|
BCD_TO_INT | Conversion of a Byte: BCD to INT format |
INT_TO_BCD | Converstion of a Byte: INT to BCD format |
EXTRACT(in,n) | The n-th bit of DWORD in is returned in BOOL |
PACK | Up to 8 bits are packed into a byte |
PUTBIT | A bit of a DWORD is set to a certain value |
UNPACK | A byte is returned as single bits |
DERIVATIVE | Local derivation |
INTEGRAL | Integral |
LIN_TRAFO | Transformation of REAL values |
STATISTICS_INT | Min., Max., average values in INT format |
STATISTICS_REAL | Min., Max., average in REAL format |
VARIANCE | Variance |
PD | PD controller |
PID | PID controller |
BLINK | Pulsating signal |
FREQ_MEASURE | Measuring frequency of boolean input signal |
GEN | Periodic functions |
CHARCURVE | Linear functions |
RAMP_INT | Limiting ascendance of descendance of the function beeing fed (INT) |
RAMP_REAL | Limiting ascendance of descendance of the function beeing fed (REAL) |
HYSTERESIS | Hysteresis |
LIMITALARM | Watches whether input value exceeds limits of a defined range |