Basic instructions
7.5 Math functions
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG
231
Table 7- 40 ENO status
0 The Math operation result value would be outside the valid number range of the data type selected. The
least significant part of the result that fits in the destination size is returned.
Division by 0 (IN2 = 0): The result is undefined and zero is returned.
Real/LReal: If one of the input values is NaN (not a number) then NaN is returned.
0 ADD Real/LReal: If both IN values are INF with different signs, this is an illegal operation and NaN is
0 SUB Real/LReal: If both IN values are INF with the same sign, this is an illegal operation and NaN is
0 MUL Real/LReal: If one IN value is zero and the other is INF, this is an illegal operation and NaN is
DIV Real/LReal: If both IN values are zero or INF, this is an illegal operation and NaN is returned.
MOD (return remainder of division) instruction
Table 7- 41 Modulo (return remainder of division) instruction
You can use the MOD instruction to return the remainder of an integer
division operation. The value at the IN1 input is divided by the value at
the IN2 input and the remainder is returned at the OUT output.
1
For LAD and FBD: Click the "???" and select a data type from the drop-down menu.
Table 7- 42 Data types for parameters
SInt, Int, DInt, USInt, UInt, UDInt, Constant
SInt, Int, DInt, USInt, UInt, UDInt
1
The IN1, IN2, and OUT parameters must be the same data type.
Table 7- 43 ENO values
Value IN2 = 0, OUT is assigned the value zero