A Brief Introduction to TwinCAT PLC Control 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 The evaluation of expression takes place by means of processing the operators according to certain binding rules. The operator with the strongest binding is processed first, then the operator with the next strongest binding, etc., until all operators have been processed. Operators with equal binding strength are processed from left to right. Below you find a table of the ST operators in the order of their binding strength: There are the following instructions in ST, arranged in a table together with example: TX1200 18 Version:
1.3 Operation Symbol Binding strength Put in parentheses (expression) Strongest binding Function call Function name (parameter list) Exponentiation EXPT Negate Building of complements - NOT Multiply Divide Modulo * / MOD Add Subtract + - Compare , = Equal to Not Equal to = Boolean AND AND Boolean XOR XOR Boolean OR OR Weakest binding