Program instructions
7.8 Math
S7-200 SMART
302
System Manual, V2.3, 07/2017, A5E03822230-AF
7.8.3
Trigonometry, natural logarithm/exponential, and square root
Sine (SIN), Cosine (COS), and Tangent (TAN) instructions
LAD / FBD
STL
Description
SIN IN, OUT
The sine (SIN), cosine (COS), and tangent (TAN) instructions evaluate the trigo-
nometric function of the angle value IN and place the result in OUT. The input
angle value is measured in radians.
•
SIN (IN) = OUT
•
COS (IN) = OUT
•
TAN (IN) = OUT
To convert an angle from degrees to radians: Use the MUL_R (*R) instruction to
multiply the angle in degrees by 1.745329E-
2 (approximately by π/180).
For the numeric functions instructions, SM1.1 is used to indicate overflow errors
and illegal values. If SM1.1 is set, then the status of SM1.0 and SM1.2 is not
valid and the original input operands are not altered. If SM1.1 is not set, then the
math operation has completed with a valid result and SM1.0 and SM1.2 contain
valid status.
COS IN, OUT
TAN IN, OUT
Non-fatal errors with ENO = 0
SM bits affected
•
0006H Indirect address
•
SM1.1 Overflow
•
SM1.0 Result of operation = zero
•
SM1.1 Overflow, illegal value generated during the operation, or illegal input
•
SM1.2 Negative result
Input / outputs Data type
Operand
IN
REAL
1
ID, QD, VD, MD, SMD, SD, LD, AC, *VD, *LD, *AC, Constant
OUT
REAL
1
ID, QD, VD, MD, SMD, SD, LD, AC, *VD, *LD, *AC
1
Real (or floating-point) numbers are represented in the format described in the ANSI/IEEE 754-1985 standard (single-
precision). Refer to that standard for more information.