SIMATIC Instructions
9-85
S7-200 Programmable Controller System Manual
A5E00066097-02
9.8 SIMATIC Numerical Functions Instructions
Square Root
The Square Root instruction takes the square root of a
32-bit real number (IN) and produces a 32-bit real
number result (OUT) as shown in the equation:
√ IN = OUT
Error conditions that set ENO = 0: SM1.1 (overflow),
SM4.3 (run-time), 0006 (indirect address)
This instruction affects the following Special Memory bits:
SM1.0 (zero); SM1.1 (overflow); SM1.2 (negative).
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. To obtain other roots, see
Natural Exponential on page 9-86.
Inputs/Outputs Operands Data Types
IN VD, ID, QD, MD, SMD, SD, LD, AC, Constant, *VD, *AC, *LD REAL
OUT VD, ID, QD, MD, SMD, SD, LD, AC, *VD, *AC, *LD REAL
Natural Logarithm
The Natural Logarithm instruction performs the natural
logarithm of the value in IN and places the result in OUT.
To obtain the base 10 logarithm from the natural
logarithm, use DIV_R (/R) to divide the natural logarithm
by 2.302585 (approximately the natural log of 10).
Error conditions that set ENO = 0: SM1.1 (overflow),
0006 (indirect address)
This instruction affects the following Special Memory bits:
SM1.0 (zero); SM1.1 (overflow); SM1.2 (negative),
SM4.3 (run-time).
Inputs/Outputs Operands Data Types
IN VD, ID, QD, MD, SMD, SD, LD, AC, Constant, *VD, *AC, *LD REAL
OUT VD, ID, QD, MD, SMD, SD, LD, AC, *VD, *AC, *LD REAL
L
A
D
S
T
L
SQRT IN, OUT
SQRT
EN
IN OUT
ENO
F
B
D
L
A
D
222 224
✓✓✓
221 226
✓
L
A
D
S
T
L
LN IN, OUT
LN
EN
IN OUT
ENO
F
B
D
L
A
D
224 226
✓
222221
✓