Mitsubishi MELSEC QCPU Programming Manual page 223

Programmable logic controller
Table of Contents

Advertisement

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

Advertisement

Table of Contents
loading

This manual is also suitable for:

Melsec qnacpuMelsec q modeMelsec q series

Table of Contents