Flexible NC programming
1.8 Priority of the operations
Job planning
1-24 Programming Manual, 03/2006 Edition, 6FC5398-2BP10-1BA0
Example: calculate and evaluate the quotient of both operands
R1=61.01 R2=61.02 R3=0.01 ;Assignment of initial values
IF ABS((R2-R1)/R3)-1) > 10EX-5 GOTOF
ERROR
;Jump not executed
M30 ;End of program
ERROR: SETAL(66000)
1.8 1.8 Priority of the operations
Function
Each operator is assigned a priority. When an expression is evaluated, the operators with
the highest priority are always applied first. Where operators have the same priority, the
evaluation is from left to right.
In arithmetic expressions, the execution order of all the operators can be specified by
parentheses, in order to override the normal priority rules.
Order of operators
From the highest to lowest priority
1. NOT, B_NOT Negation, bit-serial negation
2. *, /, DIV, MOD Multiplication, division
3. +, – Addition, subtraction
4. B_AND Bit AND
5. B_XOR Bit-serial exclusive OR
6. B_OR Bit-serial OR
7. AND AND
8. XOR Exclusive OR
9. OR OR
10. << Concatenation of strings, result type STRING
11. ==, <>, >, <, >=, <= Comparison operators
Note
The concatenation operator ":" for Frames must not be used in the same expression as other
operators. A priority level is therefore not required for this operator.
Example: IF statement
If (otto==10) and (anna==20) gotof end