Programming examples
Program code Comment
R1=R1+1 ; New R1 = old R1 + 1
R1=R2+R3 R4=R5-R6 R7=R8*R9
R10=R11/R12 R13=SIN(25.3)
R14=R1*R2+R3 ; Multiplication or division takes precedence
over addition or subtraction.
R14=(R1+R2)*R3 ; Expressions and parentheses are calculated
first.
R15=SQRT(POT(R1)+POT(R2)) ; Inner parentheses are resolved first:
R15 = square root of ( (R1^2 + R2^2) )
RESFRAME=FRAME1:FRAME2
FRAME3=CTRANS(…):CROT(…)
; FRAME logic operation with chain operator
Value assignment at a FRAME component
3.1.3.2 Comparison and logic operations
Comparison operations can be used, for example, to formulate a jump condition. Complex
expressions can also be compared.
The comparison operations are applicable to variables of type CHAR, INT, REAL and BOOL.
The code value is compared with the CHAR type.
For types STRING, AXIS and FRAME, the following are possible: == and <>, which can be used
for STRING type operations, even in synchronous actions.
The result of comparison operations is always of BOOL type.
Logic operators are used to link truth values.
The logical operations can only be applied to type BOOL variables. However, they can also be
applied to the CHAR, INT and REAL data types via internal type conversion.
For the logic (Boolean) operations, the following applies to the BOOL, CHAR, INT and REAL
data types:
● 0 corresponds to: FALSE
● Not equal to 0 means: TRUE
Bit-by-bit logic operators
Logic operations can also be applied to single bits of types CHAR and INT. Type conversion is
automatic.
Programming
Relational operator Meaning
== Equal to
<> Not equal to
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to
Work preparation
3.1 Flexible NC programming
NC programming
442 Programming Manual, 12/2019, 6FC5398-2EP40-0BA0