Operators For Conditions And Actions - Siemens SINUMERIK 840D sl Programming Manual

Job planning
Hide thumbs Also See for SINUMERIK 840D sl:
Table of Contents

Advertisement

Motion synchronous actions

10.2 Operators for conditions and actions

10.2
Operators for conditions and actions
10.2
Comparison
(==, <>, <, >, <=, >=)
Boolean operators
(NOT, AND, OR, XOR)
Bit-by-bit operators
(B_NOT, B_AND, B_OR, B_XOR)
Basic arithmetic operations
(+, -, *, /, DIV, MOD)
Mathematical functions
(SIN, COS, TAN, ASIN, ACOS, ABS, TRUNC,
ROUND, LN, EXP, ATAN2, POT, SQRT, CTAB,
CTABINV).
Indexing
Example
• Basic arithmetic operations used together
Multiplication and division are performed before addition and subtraction and bracketing of
expressions is permissible. The operators DIV and MOD are permissible for the data type
REAL.
DO $AC_PARAM[3] = $A_INA[1]-$AA_IM[Z1]
WHENEVER $AA_IM[x2] < $AA_IM[x1]-1.9 DO $A_OUT[5] = 1
DO $AC_PARAM[3] = $INA[1]-4*SIN(45.7 $P_EP[Y])*R4
• Mathematical functions
DO $AC_PARAM[3] = COS($AC_PARAM[1])
• Real-time expressions
ID=1 WHENEVER ($AA_IM[Y]>30) AND ($AA_IM[Y]<40)
DO $AA_OVR[S1]=80
ID=67 DO $A_OUT[1]=$A_IN[2] XOR $AN_MARKER[1]
ID=89 DO $A_OUT[4]=$A_IN[1] OR ($AA_IM[Y]>10)
• Main run variable indexed
WHEN...DO $AC_PARAM[$AC_MARKER[1]] = 3
Illegal
$AC_PARAM[1] = $P_EP[$AC_MARKER]
10-8
Variables or partial expressions can be
compared in conditions. The result is
always of data type BOOL. All the usual
comparison operators are permissible.
Variables, constants or comparisons can
be linked with each other with the usual
Boolean operators.
The bit operators B_NOT, B_AND, B_OR,
B_XOR can be used.
Main run variables can be linked to one
another or to constants by forms of basic
computation.
Mathematical functions cannot be applied
to variables of data type REAL.
Indexing can be undertaken using main run
expressions.
;Subtraction of two
;Main run variables
;Subtraction of a constant from variables
;Constant expression, calculated during
;preprocessing
;Selection of a position window
;Evaluate 2 Boolean signals
;Output of the result
;of a comparison
Programming Manual, 03/2006 Edition, 6FC5398-2BP10-1BA0
Job planning

Advertisement

Table of Contents
loading

Table of Contents