NEG -

PLCopen motion icon

Operator - Performs a negation of the input. (unary operator)

In FBD and FFLD language, the block NEG can be used.

Inputs

Input

Data Type

See Data Types.

Range

Unit

Default

Description

IN

ANY

 

 

 

Numeric value.

Outputs

Output

Data Type

See Data Types.

Range

Unit

Description

Q

ANY

 

 

Negation of the input.

Remarks

Truth Table

IN

Q

0

0

1

-1

-123

123

FBD Language Example

FFLD Language Example

  • In the FFLD Language, the conversion is executed only if the input rung (EN) is TRUE.
    • The output rung (ENO) keeps the same value as the input rung.
    • The negation is executed only if EN is TRUE.
    • ENO keeps the same value as EN.

IL Language Example

Not available.

ST Language Example

  • In the ST Language, - (hyphen) can be followed by a complex Boolean expression between parentheses.
    • The output data type must be the same as the input data type.
Q := -IN;
Q := - (IN1 + IN2);