Basic instructions
7.5 Math functions
S7-1200 Programmable controller
232 System Manual, 03/2014, A5E02486680-AG
NEG (Create twos complement) instruction
Table 7- 44 NEG (create twos complement) instruction
The NEG instruction inverts the arithmetic sign of the value at parameter IN and stores
the result in parameter OUT.
1
For LAD and FBD: Click the "???" and select a data type from the drop-down menu.
Table 7- 45 Data types for parameters
SInt, Int, DInt, Real, LReal, Constant
SInt, Int, DInt, Real, LReal
1
The IN and OUT parameters must be the same data type.
Table 7- 46 ENO status
1 No error
0 The resulting value is outside the valid number range of the selected data type.
Example for SInt: NEG (-128) results in +128 which exceeds the data type maximum.
INC (Increment) and DEC (Decrement) instructions
Table 7- 47 INC and DEC instructions
Increments a signed or unsigned integer number value:
IN_OUT value +1 = IN_OUT value
Decrements a signed or unsigned integer number value:
IN_OUT value - 1 = IN_OUT value
1
For LAD and FBD: Click the "???" and select a data type from the drop-down menu.