PLC

Operators

TwinCAT 3 PLC supports all operators of the IEC 61131-3 standard. These operators are implicitly known throughout the project. In addition to the IEC operators, TwinCAT 3 PLC supports some operators which are not described in the IEC 61131-3 standard.

Operators are used in a function block like functions.

 
Note
Operations with floating point data types
For operations with floating point data types, the result depends on the target system hardware used.
Note
Information about the processing order (binding strength) of the ST operators can be found in section "ST Expressions".
 

Address operators

ADR
 
 

Arithmetic operators

ADD
DIV
MOD
MOVE
MUL
SUB
 
 

Call operators

CAL
 
 

Selection operators

MAX
MIN
MUX
SEL
 
 

Bitshift Operators

ROL
ROR
SHL
SHR
 
 

Bitstring operators

AND
NOT
OR
XOR
 
 

Namespace operators

The namespace operators are an extension of the IEC 61131-3 operators. They offer options for making the access to variables or modules unique, even if you use the same variable or module name several times in the project.

 
 

Numeric operators

ABS
ACOS
ASIN
ATAN
COS
EXP
EXPT
LN
LOG
SIN
SQRT
TAN
 
 

Type conversion operators

An implicit conversion from a "larger" type to a type of "smaller" is not possible, such as from INT to BYTE or from DINT to WORD. If you want to perform implicit type conversions from a "larger" type to a "smaller" type, you must apply specific type conversions. Basically, you can convert any elementary type to any other elementary type.

Typed conversion: <elemementaryType1>_TO_<elementaryType2>

Overloaded conversion: TO_<elementaryType2>

 
Note
For ... TO_STRING conversions, TwinCAT generates the string left-aligned. If the defined string length is too short, it is truncated from the right.
 
 

Comparison operators

The comparison operators are Boolean operators, which compare two inputs (first and second operand).

EQ
GE
GT
LE
LT
NE
 
 

Further operators

 
Additional information
Address operators
Arithmetic operators
Call operators
Selection operators
Bitshift operators
Bitstring operators
Namespace operators
Numeric operators
Type conversion operators
Comparison operators
Further operators