Beckhoff Automation GmbH & Co. KG TX1200 — 2.2.2 Instruction List (IL)

A Brief Introduction to TwinCAT PLC Control Modifiers and operators in IL In the IL language the following operators and modifiers can be used. Modifiers: 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: You find a list of all IEC operators in the appendix. 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 label (*if the result was TRUE, then jump to the label "label"*) 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 ST Erg Here is the value of Erg 7. However, if one puts parentheses: TX1200 17 Version:

1.3 Operator Modifiers Meaning LD N Make current result equal to the operand ST N Save current result at the position of the Operand S Put the Boolean operand exactly at TRUE if the current result is TRUE R Put the Boolean operand exactly at FALSE if the current result is TRUE AND N, ( Bitwise AND OR N, ( Bitwise OR XOR ( Bitwise exklusive OR ADD ( Addition SUB ( Subtraction MUL ( Multiplication DIV ( Division GT ( > GE ( >= EQ ( = NE ( LE ( LT ( JMP CN Jump to label CAL CN call function block RET CN Return from call of a function block ) Evaluate deferred operation