Operators

CODESYS V3 supports all IEC-61131-3 operators. These operators are recognized implicitly throughout the project. In addition to these IEC operators, CODESYS also supports some non-IEC 61131-3 operators.

Operators are used in blocks, such as functions.

Caution

For operations with floating point data types, the computational result depends on the applied target system hardware.

Note

For information about the processing order (binding strength) of the ST operators, please refer to the section on ST expressions.

Comparison operators

A comparison operator is a Boolean that compares two inputs (first and second operand).

Operator ‘GT’

Operator ‘LT’

Operator ‘LE’

Operator ‘GE’

Operator ‘EQ’

Operator ‘NE’

Type conversion operators

Implicit conversion from a larger type to a smaller type is not possible (for example, from INT to BYTE or from DINT to WORD). You must use a special type conversion to convert from a larger type to a smaller type. As a rule, you can convert any elementary type into any other elementary type.

Typed conversion: <elem.type1>_TO_<elem.type2>

Overflow conversion: TO_<elem.type2>

Hint

For ...TO_STRING conversions, CODESYS generates the string left-aligned. If the string length is defined too short, then it will be truncated on the right.

Siehe auch

Namespace operators

Namespace operators are extended from IEC 61131-3 operators and make it possible for you to provided unique access to variables and modules, even when you use the same name multiple times for variables or modules in a project.

Operator - Global Namespace

Operator - Namespace for Global Variables Lists

Operator - Enumeration Namespace

Operator - Library Namespace