6 BASIC INSTRUCTIONS
6.6 Data Conversion Instructions
467
6
Two's complement of 16-bit binary data (sign inversion)
NEG(P)
Invert the sign of 16-bit binary device.
■Execution condition
■Description, range, data type
■Applicable devices
• These instructions invert the sign of the 16-bit binary data in the device specified by (d) and store the inverted data in the
device specified by (d).
• The instructions are used to invert positive and negative signs.
Ladder ST
ENO:=NEG(EN,d);
ENO:=NEGP(EN,d);
FBD/LD
Instruction Execution condition
NEG
NEGP
Operand Description Range Data type Data type (label)
(d) Device where the data subjected to two's complement is
stored
16-bit signed binary ANY16
EN Execution condition Bit BOOL
ENO Execution result Bit BOOL
Operand Bit Word Double word Indirect
specification
Constant Others
X, Y, M, L,
SM, F, B, SB,
FX, FY
J\ T, ST, C, D, W,
SD, SW, FD, R,
ZR, RD
U\G, J\,
U3E\(H)G
Z LT, LST,
LC
LZ K, H E $
(d)
RnCPU
RnENCPU
RnSFCPU RnSFCPURnPCPURnPCPU
(Standard) (Safety)
(Redundant)
(Process)
1
(d)
(d)
b15 b0
101 10 0101 10 01010
b15 b0
010 01 1010 01 10110
101 10 0101 10 01010
000 00 0000 00 00000
-
-21846
21846
Before execution
Sign conversion
After execution