A Brief Introduction to TwinCAT PLC Control 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:
LD 2 MUL( 2 ADD 3 ) ST Erg Here the resulting value for Erg is 10, then the operation MUL is only then evaluated if you come to ")"; as operand for MUL 5 is then calculated. 2.2.3 Structured Text (ST) The structured text consists of a series of instructions which, as determined in high level languages, ("IF..THEN..ELSE") or in loops (WHILE..DO) can be executed. Example: IF value WHILE value value := value + 1; END_WHILE; END_IF; Expressions An expression is a construction which returns a value after its evaluation. Expressions are composed of operators and operands. An operand can be a constant, a variable, a function call, or another expression.
Valuation of expressions TwinCAT 2 PLC Control 18 Version: 1.0