Operator - Performs an integer negation of the input.
IN : DINT Integer value
Q : DINT Integer negation of the input
IN |
Q |
0 |
0 |
1 |
-1 |
-123 | 123 |
In FBD and LD language, the block "NEG" can be used. In LD language, the operation is executed only if the input rung (EN) is TRUE. The output rung (ENO) keeps the same value as the input rung. This feature is not available in IL language. In ST language, "-" can be followed by a complex boolean expression between parenthesis.
Q := -IN;
Q := - (IN1 + IN2);
(* The negation is executed only if EN is
TRUE *)
(* ENO keeps the same value as EN *)
Not available