You are here: Technical References > Programming Languages > PLC Standard Libraries > Neg Integer Negation

NEG   -PLCopen motion icon

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"Function block diagram" A function block diagram describes a function between input variables and output variables. A function is described as a set of elementary blocks and FFLD language, the block "NEG" can be used.

In FFLD 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"Instruction list" This is a low-level language and resembles assembly language. In ST"Structured text" A high-level language that is block structured and syntactically resembles Pascal language, "-" can be followed by a complex Boolean expression between parentheses.

ST Language

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

FBD Language

Neg Fbd

FFLD Language

(* The negation is executed only if EN is TRUE *)
(* ENO keeps the same value as EN *)
Neg Ffld

IL Language

Not available

 


Stay Connected with Kollmorgen

Copyright © 2015 Kollmorgen™