Math; Add, Subtract, Multiply, And Divide - Siemens SIMATIC S7 System Manual

Hide thumbs Also See for SIMATIC S7:
Table of Contents

Advertisement

7.8

Math

7.8.1

Add, subtract, multiply, and divide

LAD / FBD
STL
+I IN1, OUT
+D IN1, OUT
+R IN1, OUT
ADD_DI
ADD_R
-I IN1, OUT
-D IN1, OUT
-R IN1, OUT
SUB_DI
SUB_R
*I IN1, OUT
*D IN1, OUT
*R IN1, OUT
MUL_DI
MUL_R
/I IN1, OUT
/D IN1, OUT
/R IN1, OUT
DIV_DI
DIV_R
Non-fatal errors with ENO = 0
0006H Indirect address
SM1.1 Overflow
SM1.3 Divide by zero
S7-200 SMART
System Manual, V2.3, 07/2017, A5E03822230-AF
Description
The Add Integer instruction adds two 16-bit integers to produce a 16-bit
result. The Add Double Integer instruction adds two 32-bit integers to pro-
duce a 32-bit result. The Add Real (+R) instruction adds two 32-bit real
numbers to produce a 32-bit real number result.
LAD and FBD: IN1 + IN2 = OUT
STL: IN1 + OUT = OUT
The Subtract Integer instruction subtracts two 16-bit integers to produce a
16-bit result. The Subtract Double Integer (-D) instruction subtracts two 32-
bit integers to produce a 32-bit result. The Subtract Real (-R) instruction
subtracts two 32-bit real numbers to produce a 32-bit real number result.
LAD and FBD: IN1 - IN2 = OUT
STL: OUT - IN1 = OUT
The Multiply Integer instruction multiplies two 16-bit integers to produce a
16-bit result. The Multiply Double Integer instruction multiplies two 32-bit
integers to produce a 32-bit result. The Multiply Real instruction multiplies
two 32-bit real numbers to produce a 32-bit real number result.
LAD and FBD: IN1 * IN2 = OUT
STL: IN1 * OUT = OUT
The Divide Integer instruction divides two 16-bit integers to produce a 16-bit
result. (No remainder is kept.) Divide Double Integer instruction divides two
32-bit integers to produce a 32-bit result. (No remainder is kept.) The Divide
Real (/R) instruction divides two 32-bit real numbers to produce a 32-bit real
number result.
LAD and FBD: IN1 / IN2 = OUT
STL: OUT / IN1 = OUT
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
SM1.3 Divide by zero
Program instructions
7.8 Math
297

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Simatic s7-200 smart

Table of Contents