Basic instructions
8.5 Math functions
S7-1200 Programmable controller
258 System Manual, V4.2, 09/2016, A5E02486680-AK
Table 8- 46 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.
0 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 re-
0 SUB Real/LReal: If both IN values are INF with the same sign, this is an illegal operation and NaN is re-
0 MUL Real/LReal: If one IN value is zero and the other is INF, this is an illegal operation and NaN is re-
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)
Table 8- 47 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 8- 48 Data types for parameters
SInt, Int, DInt, USInt, UInt, UDInt, Constant
OUT SInt, Int, DInt, USInt, UInt, UDInt Modulo output
1
The IN1, IN2, and OUT parameters must be the same data type.
Table 8- 49 ENO values
1 No error
Value IN2 = 0, OUT is assigned the value zero