Two's Complement Of 16-Bit Binary Data (Sign Inversion) - Mitsubishi MELSEC iQ-F FX5 series Programming Manual

Melsec iq-f fx5 series
Hide thumbs Also See for MELSEC iQ-F FX5 series:
Table of Contents

Advertisement

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).
Ladder diagram
(d)
Setting data
■Descriptions, ranges, and data types
Operand
Description
(d)
Head device for storing the data that performs two's
complement
■Applicable devices
Operand
Bit
X, Y, M, L,
SM, F, B, SB
(d)
Processing details
• 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.
Before execution
(d)
1
Sign conversion
-
After execution
(d)
Precautions
Note that data is inverted in every operation cycle in a continuous operation type (NEG) instruction.
Operation error
There is no operation error.
6 BASIC INSTRUCTIONS
282
6.5 Data Conversion Instructions
Word
U\G T, ST,
T, ST, C, D,
C, LC
W, SD, SW, R
16 bits
b15
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
1
0
1
0
1
0
1
0
b15
0
1
0
1
0
1
0
1
Structured text
ENO:=NEG(EN,d);
ENO:=NEGP(EN,d);
Range
-32768 to +32767
Double word Indirect
U\G
Z
LC
···
1
0
1
0
1
0
1
0
0
0
0
0
0
0
1
0
1
0
1
0
1
···
0
1
0
1
0
1
1
Data type
16-bit signed binary
Constant
specification
LZ
K, H
b0
··· -21846
0
0
0
b0
0
··· 21846
Data type (label)
ANY16
Others
E
$

Advertisement

Table of Contents
loading

Table of Contents