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.
Arithmetic operators
Bitstring operators
Bitshift operators
Selection operators
Comparison operators
A comparison operator is a Boolean that compares two inputs (first and second operand).
Address operators
Call operators
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>
Attention
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
- Operator ‘BOOL_TO’
- Operator ‘TO_BOOL’
- Operator ‘<INT Type>_TO_<INT Type>’
- Operator ‘REAL_TO-/ LREAL-TO’
- Operator ‘TIME_TO/TIME_OF_DAY_TO’
- Operator ‘DATE_TO/DT_TO’
- Operator ‘STRING_TO’
- Operator ‘TRUNC’
- Operator ‘TRUNC_INT’
- Operator ‘TO_<xxx>
Numeric Operators
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 - Namespace for Global Variables Lists
Operator - Enumeration Namespace
Other operators
- Operator ‘ADD’
- Operator ‘MUL’
- Operator ‘SUB’
- Operator ‘DIV’
- Operator ‘MOD’
- Operator ‘MOVE’
- Operator ‘INDEXOF’
- Operator ‘SIZEOF’
- Operator ‘NOT’
- Operator ‘AND’
- Operator ‘OR’
- Operator ‘XOR’
- Operator ‘AND_THEN’
- Operator ‘OR_ELSE’
- Operator ‘SHL’
- Operator ‘SHR’
- Operator ‘ROL’
- Operator ‘ROR’
- Operator ‘SEL’
- Operator ‘MAX’
- Operator ‘MIN’
- Operator ‘LIMIT’
- Operator ‘MUX’
- Operator ‘GT’
- Operator ‘LT’
- Operator ‘LE’
- Operator ‘GE’
- Operator ‘EQ’
- Operator ‘NE’
- Operator ‘ADR’
- Operator ‘Content Operator’
- Operator ‘BITADR’
- Operator ‘CAL’
- Operator ‘BOOL_TO’
- Operator ‘TO_BOOL’
- Operator ‘TO_<xxx>
- Operator ‘<INT Type>_TO_<INT Type>’
- Operator ‘REAL_TO-/ LREAL-TO’
- Operator ‘TIME_TO/TIME_OF_DAY_TO’
- Operator ‘DATE_TO/DT_TO’
- Operator ‘STRING_TO’
- Operator ‘TRUNC’
- Operator ‘TRUNC_INT’
- Operator ‘ABS’
- Operator ‘SQRT’
- Operator ‘LN’
- Operator ‘LOG’
- Operator ‘EXP’
- Operator ‘EXPT’
- Operator ‘SIN’
- Operator ‘COS’
- Operator ‘TAN’
- Operator ‘ASIN’
- Operator ‘ACOS’
- Operator ‘ATAN’
- Operator ‘__DELETE’
- Operator ‘__ISVALIDREF’
- Operator ‘__NEW’
- Operator ‘__QUERYINTERFACE’
- Operator ‘__QUERYPOINTER’
- Operators ‘__TRY’, ‘__CATCH’, ‘__FINALLY’, ‘__ENDTRY’
- Operator ‘__VARINFO’
- Operator - Global Namespace
- Operator - Namespace for Global Variables Lists
- Operator - Library Namespace
- Operator - Enumeration Namespace
- Operator ‘INI’