282
6 BASIC INSTRUCTIONS
6.5 Data Conversion Instructions
Two's complement of 16-bit binary data (sign inversion)
NEG(P)
These instructions invert the sign of the 16-bit binary data in the device specified by (d), and store the resultant data in the
device specified by (d).
■Descriptions, ranges, and data types
■Applicable devices
• These instructions invert the sign of the 16-bit binary data in the device specified by (d), and store the resultant data in the
device specified by (d).
• They are used when a positive or negative sign is to be inverted.
Note that data is inverted in every operation cycle in a continuous operation type (NEG) instruction.
There is no operation error.
Ladder diagram Structured text
ENO:=NEG(EN,d);
ENO:=NEGP(EN,d);
Operand Description Range Data type Data type (label)
(d) Head device for storing the data that performs two's
complement
-32768 to +32767 16-bit signed binary ANY16
Operand Bit Word Double word Indirect
specification
Constant Others
X, Y, M, L,
SM, F, B, SB
U\G T, ST,
C, LC
T, ST, C, D,
W, SD, SW, R
U\G Z LC LZ K, H E $
(d)
1
(d)
(d)
···b15 b0
101 10 0101 10 01010
···b15 b0
010 01 1 010 01 10110
101 10 0101 10 01010
000 00 0000 00 00000
-
··· -21846
··· 21846
Before execution
Sign conversion
After execution
16 bits