Programming Actions and Conditions
S7-GRAPH for S7 300/400 Programming Sequential Control Systems
7-12
C79000-G7076-C526-01
Assignments with Built-in Function
Assignments with a built-in Function are entered with the syntax A:=func(B).
These assignments are essentially conversions functions and complex math
functions. The assigned address A specifies the data type of the expression. You
can use the following assignments with a built-in function:
Assignment with
Built-in Function
Comment
Conversion functions:
A := BCD_TO_NUM(B)
BCD to INT or DINT (STL instructions: BTI, BTD)
A := NUM_TO_BCD(B)
INT or DINT to BCD (STL instructions: ITB, DTB)
A := INT_TO_DINT(B)
INT to DINT (STL instruction: ITD)
A := DINT_TO_REAL(B)
DINT to REAL (STL instruction: DTR)
A := ROUND(B)
REAL to DINT (STL instruction: RND)
A := TRUNC(B)
REAL to DINT, truncate remainder (STL instruction: TRUNC)
Math functions:
A := NEGR(B)
REAL negation
A := ABS(B)
REAL absolute value
A := SQR(B)
REAL square
A := SQRT(B)
REAL square root
A := LN(B)
REAL logarithm to base e
A := EXP(B)
REAL exponent to base e
A := SIN(B)
REAL sine
A := ASIN(B)
REAL arc sine
A := COS(B)
REAL cosine
A := ACOS(B)
REAL arc cosine
A := TAN(B)
REAL tangent
A := ATAN(B)
REAL arc tangent
A := NEG(B)
Negation (two’s complement)
(STL instructions: NEGI, NEGD, NEGR)
Other Functions:
A := NOT(B)
One’s complement (STL instructions: INVI, INVD)
A := SWAP(B)
Swap bytes (STL instructions: TAD, TAW)
A := RLDA(B)
Rotate 32 bits left by 1 bit via CC1 (STL instruction: RLDA)
A := RRDA(B)
Rotate 32 bits right by 1 bit via CC1 (STL instruction: RRDA)