IEC 1131-3 Instructions
10-18
S7-200 Programmable Controller System Manual
A5E00066097-02
10.5 IEC Math Instructions
Add, Subtract
The Add and Subtract functions add or subtract IN1 and
IN2 and place the result in OUT. The input and output
data types can vary, but must be of the same type. For
example, two 16-bit variables can be added or
subtracted, but the result must be placed in a 16-bit
variable; the result of adding or subtracting two 32-bit
variables must be placed in a 32-bit variable.
In LAD: IN1 + IN2 = OUT
IN1 - IN2 = OUT
Error conditions that set ENO = 0: SM1.1 (overflow),
SM4.3 (run-time), 0006 (indirect address)
These functions affect the following Special Memory bits:
SM1.0 (zero); SM1.1 (overflow); SM1.2 (negative)
Inputs/Outputs
Operands Data Types
IN1, IN2 VW, IW, QW, MW, SW, SMW, LW, AIW, T, C, VD, ID, QD, MD,
SMD, SD, LD, HC, AC, Constant, *VD, *AC, *LD
INT, DINT, REAL
OUT VW, IW, QW, MW, SW, SMW, LW, T, C, VD, ID, QD, MD, SMD,
SD, LD, AC, *VD, *AC, *LD
INT, DINT, REAL
Note
Real or floating-point numbers are represented in the format described in the
ANSI/IEEE 754-1985 standard (single-precision). Refer to the standard for more
information.
Multiply, Divide
The Multiply function multiplies IN1 and IN2 and places
the result in the variable specified by OUT.
The Divide function divides IN1 by IN2 and places the
result in the variable specified by OUT.
The input and output data types can vary, but must be of
the same type. For example, the product of multiplying
two 16-bit variables must be placed in a 16-bit variable,
the product of multiplying two 32-bit variables must be
placed in a 32-bit variable.
In LAD: IN1IN2 = OUT
IN1 / IN2 = OUT
Error conditions that set ENO = 0: SM1.1 (overflow),
SM1.3 (divide-by-zero), SM4.3 (run-time), 0006 (indirect
address)
L
A
D
F
B
D
OUT
ADD
EN
IN1
IN2
OUT
OUT
SUB
EN
IN1
IN2
OUT
ENO
ENO
222 224
✓✓✓
221 226
✓
L
A
D
F
B
D
OUT
MUL
EN
IN1
IN2
OUT
OUT
DIV
EN
IN1
IN2
OUT
ENO
ENO
222 224
✓✓✓
221 226
✓