Modifiers and Operators in IL¶
In the IL language the following operators and modifiers can be used.
C | with JMP, CAL, RET: | The instruction is only then executed if the result of the preceding expression is TRUE. · |
N | with JMPC, CALC, RETC: | The instruction is only then executed if the result of the preceding expression is FALSE. |
N | otherwise: | Negation of the operand (not of the accumulator) Below you find a table of all operators in IL with their possible modifiers and the relevant meaning: |
Below you find a table of all operators in IL with their possible modifiers and the relevant meaning:
Operator | Modifiers | Meaning |
---|---|---|
LD | N | Make current result equal to the operand |
ST | N | Save current result at the position of the operand |
S | Then put the Boolean operand exactly at TRUE if the current result is TRUE | |
R | Then put the Boolean operand exactly at FALSE if the current result is TRUE | |
AND | N,( | Bitwise AND |
OR | N,( | Bitwise OR |
XOR | N,( | Bitwise exclusive OR |
ADD | ( | Addition |
SUB | ( | Subtraction |
MUL | ( | Multiplication |
DIV | ( | Division |
GT | ( | > |
GE | ( | >= |
EQ | ( | = |
NE | ( | <> |
LE | ( | <= |
LT | ( | < |
JMP | CN | Jump to the label |
CAL | CN | Call programor function block or |
RET | CN | Leave POU and return to caller. |
) | Evaluate deferred operation |
Example of an IL program while using some modifiers:
LD | TRUE | (*load TRUE in the accumulator*) |
ANDN | BOOL1 | (*execute AND with the negated value of the BOOL1 variable*) |
JMPC | mark | (*if the result was TRUE, then jump to the label “mark”*) |
LDN | BOOL2 | (*save the negated value of *) |
ST | ERG | (*BOOL2 in ERG*) |
label: | ||
LD | BOOL2 | (*save the value of *) |
ST | ERG | *BOOL2 in ERG*) |
It is also possible in IL to put parentheses after an operation. The value of the parenthesis is then considered as an operand.
For example:
LD 2
MUL 2
ADD 3
Erg
Here is the value of Erg 7. However, if one puts parentheses:
LD 2
MUL (2
ADD 3
)
ST Erg
The resulting value for Erg is 10, the operation MUL is only then evaluated if you come to “)”; as operand for MUL 5 is then calculated.