Mitsubishi MELSEC QS Series Programming Manual page 126

Hide thumbs Also See for MELSEC QS Series:
Table of Contents

Advertisement

NEG(P), DNEG(P)
DNEG
(1) Reverses the sign of the 32-bit device designated by
by
D
Before
execution
Sign
conversion
After
execution
(2) Used when reversing positive and negative signs.
Operation Error
(1) There are no operation errors associated with the NEG(P) or DNEG(P) instructions.
Program Example
(1) The following program calculates a total for the data at D10 through D20 when XA goes ON,
and seeks an absolute value if the result is negative.
[Ladder Mode]
6-28
6.3 Data Conversion Instructions
6.3.3 Complement of 2 of BIN 16- and 32-bit data (sign reversal) (NEG(P), DNEG(P))
.
b31
D
1
1
1
1
1
0
0
0
0
1
1
1
1
b31
0
0
0
0
D
and stores at the device designated
D
32 bits
0
0
1
1
1
1
0
0
0
0
0
0
1
1
1
0
1
0
0
0
0
1
0
1
M3 is turned ON when D10
Executes "D10
Calculates the absolute value
(complement of 2) when M3 is ON.
b0
0
0
0
−218460
1
0
0
0
0
0
1
0
0
b0
1
1
0
0
218460
D20.
D20".

Advertisement

Table of Contents
loading

Table of Contents