NEG   -

Operator - Performs an integer negation of the input.

Inputs

IN : DINT  Integer value

Outputs

Q : DINT   Integer negation of the input

Truth table (examples

IN

Q

0

0

1

-1

-123 123

Remarks

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.

ST Language

Q := -IN;
Q := - (IN1 + IN2);

FBD Language

NegFbd.gif (1147 octets)

LD Language

(* The negation is executed only if EN is TRUE *)
(* ENO keeps the same value as EN *)
NegLd.gif (1396 octets)

IL Language:

Not available