Modifiers and Operators in IL¶
Modifier | Combined with operator | Description |
---|---|---|
C |
JMP , CAL , RET |
The command is only executed if the result of the preceding expression is TRUE . |
N |
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 | N | Meaning | Example |
---|---|---|---|
LD |
N |
Loads the (negated) the value of the operand into the accumulator. | LD ivar |
ST |
N |
Stores the (negated) content of the accumulator in the operand. | ST iErg |
S |
Sets the operand (type BOOL ) to TRUE if the content of the accumulator is TRUE . |
S bVar1 |
|
R |
Sets the operand (type BOOL ) to FALSE if the content of the accumulator is TRUE . |
R bVar1 |
|
AND |
N,( |
Bitwise AND of the accumulator value and (negated) operand |
AND bVar2 |
OR |
N,( |
Bitwise OR of the accumulator value and (negated) operand | OR xVar |
XOR |
N,( |
Bitwise exclusive OR of the accumulator value and (negated) operand | XOR N,(bVar1,bVar2) |
NOT |
Bitwise negation of the accumulator value | ||
ADD |
( |
Addition of the accumulator value and the operand; result is written into the accumulator. | ADD ivar1 |
SUB |
( |
Subtraction of the operand from the accumulator value; result is written into the accumulator. | SUB iVar2 |
MUL |
( |
Multiplication of accumulator value and operand; result is written into the accumulator. | MUL ivar2 |
DIV |
( |
Division of the accumulator value by the operand; result is written into the accumulator. | DIV 44 |
GT |
( |
Checks whether the accumulator value is greater than the operand value; result (BOOL ) is written into the accumulator; > |
GT 23 |
GE |
( |
Checks whether the accumulator value is greater than or equal to the operand value; result (BOOL ) is written into the accumulator. |
GE iVar2 |
EQ |
( |
Checks whether the accumulator value is equal to the operand value; result (BOOL ) is written into the accumulator. |
EQ iVar2 |
NE |
( |
Checks whether the accumulator value is not equal to the operand value; result (BOOL ) is written into the accumulator; |
NE iVar1 |
LE |
( |
Checks whether the accumulator value is smaller than or equal to the operand value; result (BOOL ) is written into the accumulator. |
LE 5 |
LT |
( |
Checks whether the accumulator value is smaller than the operand value; result (BOOL) is written into the accumulator. | LT cVar1 |
JMP |
CN |
Unconditional (conditional) jump to the specified jump label | JMPN next |
CAL |
CN |
(Conditional) call of a program or a function block (if the accumulator value is TRUE) | CAL prog1 |
RET |
Exit the box and return to the calling box. | RET |
|
RET |
C |
If the accumulator value is TRUE : exit the box and return to the calling box. |
RETC |
RET |
CN |
If the accumulator value is FALSE : exit the box and return to the calling box. |
RETCN |
) |
Evaluation of the reset operation |
Example
Application | Description | Examples |
---|---|---|
Several operands for 1 operator | Options
|
Variant 1 : Variant 2 : |
Complex operands | For a complex operand, you enter the opening parenthesis ( in the first column. You enter the closing parenthesis in the first column in a separate row following the operand entries of the following rows. |
A string is rotated by a character each cycle: |
Function block call, program call | Column 1: Operator Column 2: Name of the function block instance or the program and opening parenthesis rows following that: Column 1: parameter name followed by Column 2: parameter value followed by a comma As a limitation according to the IEC standard, complex expressions cannot be used here. You must assign such constructs to the function block or the program before the call. |
|
Function Call | Row 1: Column 1: Column 2: input variable Row 2: Column 1: Function name Column 2: further input parameters separated by commas. CODESYS writes the return value into the accumulator. Row 3: Column 1: |
|
Action call | Like function block call or program call. The action name is appended to the name of the FB instance or the program. |
|
Jump | Column 1: operator Column 2: Name of the jump label of the destination network. In the case of an unconditional jump, the preceding instruction sequence must end with one of the following commands: In the case of a conditional jump the execution of the jump depends on the loaded value. |
See also