6 - 72 6 - 72
MELSEC-Q/QnA
6 BASIC INSTRUCTIONS
DNEG
(1) Reverses the sign of the 32-bit device designated by
D
and stores at the device designated by
D
.
32 Bit
11
1 1 1 1 101 0 0 1 00
000 0 0 0 0 0 0 0 0 0 00
111 1 1 1 1 0 1 0 0 1 00
1
0 0 0
1 1 1
0
Sign conversion
218460
0000 0
1
0
Before execution
D
After execution
D
-218460
.............
.............
-
b31- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -b0
b31- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -b0
(2) Used when reversing positive and negative signs.
[Operation Errors]
(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]
M3 goes ON if D10 is smaller than D2
Subtracts D20 from D10
Seeks an absolute value (complement
of 2) when M3 is ON
[List Mode]
InstructionSteps
Device
LD
AND<
0
1
4
5
6
8
12
OUT
LD
-P
AND
NEGP
END
X0A
D10
D20
M3
X0A
D20
M3
D10
9
D10
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com