Mitsubishi Electric M800VW Series Programming Manual page 230

Plc programming
Hide thumbs Also See for M800VW Series:
Table of Contents

Advertisement

M800V/M80V Series PLC Programming Manual (1/2)
8 Function Instructions
8.2 Arithmetic Operation Instructions
DNEG
 Reverses the sign of the 32-bit device designated by "D" and stores at the device designated by "D".
Before execution
D
1
Sign conversion
After execution
D
 Used when reversing positive and negative signs.
 Operation errors
 There are no arithmetic errors associated with the NEG(P) or DNEG(P) instructions.
 Program example
 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.
XA
< D10 D20
0
XA
5
M3
13
[List mode]
Steps
Inst.
Device
0
LD
1
AND<
D10
4
OUT
5
LD
6
-
10
AND
11
NEG
13
END
32 Bit
b31
1 1 1 1 1 1 1
0 0 0 0 0 0 0
1 1 1 1 1 1 1
b31
0 0 0 0 0 0 0
[Ladder mode]
M3
- D10 D20 D10
NEG D10
END
XA
D20
M3
XA
D10
D20
D10
M3
D10
b0
-218460
0 1 0 0 1 0 0
0 0 0 0 0 0 0
0 1 0 0 1 0 0
b0
218460
1 0 1 1 1 0 0
M3 goes ON when D10 is smaller than D20.
Subtracts D20 from D10.
Seeks an absolute value (complement of 2)
when M3 is ON
209
IB-1501667-B

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents