2-369
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Conversion Instructions
2
Neg
Neg
The Neg instruction reverses the sign of a number.
* If you omit the input parameter, the default value is not applied. A building error will occur.
The Neg instruction reverses the sign of data to convert In. The value of Out depends on the data type
of In.
Instruction Name FB/FUN Graphic expression ST expression
Neg Reverse Sign FUN Out:=Neg(In);
Variables
Name Meaning I/O Description Valid range Unit Default
In Data to
convert
Input Data to convert Depends on data type.
--- *
Out Conver-
sion result
Output Conversion result Depends on data type.
--- ---
Boolean
Bit strings Integers
Real
numbers
Times, durations,
dates, and text strings
BOOL
BYTE
WORD
DWORD
LWORD
USINT
UINT
UDINT
ULINT
SINT
INT
DINT
LINT
REAL
LREAL
TIME
DATE
TOD
DT
STRING
In OK OK OK OK OK OK OK OK OK OK
Out OKOKOKOKOKOKOKOKOKOK
Function
Data type of In Value of Out
Signed integer:
SINT, INT, DINT, or LINT
All bits in In are reversed and then 1 is
added. (This is the same as multiplying
In by −1.)
Unsigned integers:
USINT, UNIT, UDINT, or ULINT
All bits in In are reversed and then 1 is
added.
Real numbers:
REAL or LREAL
In × (−1)
(@)Neg
EN ENO
In Out