286 Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Chapter 6 Compute/Math Instructions (CPT, ADD, SUB, MUL, DIV, MOD, SQR, SQRT, NEG, ABS)
Negate (NEG)
The NEG instruction changes the sign of the Source and places the result in the
Destination.
Operands:
Relay Ladder
Structured Text
Use the minus sign ‘−’ as an operator in an expression. This expression changes
the sign of source and stores the result in dest.
See Structured Text Programming
for information on the syntax of expressions
within structured text.
Function Block
FBD_MATH Structure
Operand Type Format Description
Source SINT
INT
DINT
REAL
Immediate Tag Value to negate
A SINT or INT tag converts to a DINT value by sign-extension.
Destination SINT
INT
DINT
REAL
Tag Tag to store the result
Operand Type Format Description
NEG tag FBD_MATH_ADVANCED Structure NEG structure
Input Parameter Data Type Description
EnableIn BOOL Enable input. If cleared, the instruction does not execute and outputs are not updated.
Default is set.
Source REAL Value to negate.
Valid = any float
Output Parameter Data Type Description
EnableOut BOOL The instruction produced a valid result.
Dest REAL Result of the math instruction. Arithmetic status flags are set for this output.