Program instructions
7.8 Math
7.8.3
Trigonometry, natural logarithm/exponential, and square root
Sine (SIN), Cosine (COS), and Tangent (TAN) instructions
LAD / FBD
STL
SIN IN, OUT
COS IN, OUT
TAN IN, OUT
Non-fatal errors with ENO = 0
0006H Indirect address
•
SM1.1 Overflow
•
Input / outputs
Data type
IN
REAL
1
OUT
REAL
1
Real (or floating-point) numbers are represented in the format described in the ANSI/IEEE 754-1985 standard (single-
1
precision). Refer to that standard for more information.
302
Description
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.
SM bits affected
SM1.0 Result of operation = zero
•
SM1.1 Overflow, illegal value generated during the operation, or illegal input
•
SM1.2 Negative result
•
Operand
ID, QD, VD, MD, SMD, SD, LD, AC, *VD, *LD, *AC, Constant
ID, QD, VD, MD, SMD, SD, LD, AC, *VD, *LD, *AC
System Manual, V2.3, 07/2017, A5E03822230-AF
S7-200 SMART