Comparison And Logic Operations - Siemens SINUMERIK 840D sl Programming Manual

Nc programming
Hide thumbs Also See for SINUMERIK 840D sl:
Table of Contents

Advertisement

Work preparation
3.1 Flexible NC programming
Programming examples
Program code
R1=R1+1
R1=R2+R3
R10=R11/R12
R14=R1*R2+R3
R14=(R1+R2)*R3
R15=SQRT(POT(R1)+POT(R2))
RESFRAME=FRAME1:FRAME2
FRAME3=CTRANS(...):CROT(...)
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
==
<>
>
<
>=
<=
442
R4=R5-R6
R7=R8*R9
R13=SIN(25.3)
Comment
; New R1 = old R1 + 1
; Multiplication or division takes precedence
over addition or subtraction.
; Expressions and parentheses are calculated
first.
; Inner parentheses are resolved first:
R15 = square root of ( (R1^2 + R2^2) )
; FRAME logic operation with chain operator
Value assignment at a FRAME component
Meaning
Equal to
Not equal to
Greater than
Less than
Greater than or equal to
Less than or equal to
Programming Manual, 12/2019, 6FC5398-2EP40-0BA0
NC programming

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sinumerik 840de sl

Table of Contents