Mitsubishi Electric M800VW Series Programming Manual page 199

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
D-
 Subtracts 32-bit BIN data designated by (S1) from 32-bit BIN data designated by (S2), and stores the result of the subtrac-
tion at the device designated by (D).
S1+1
S1
b31
b16
b15
b0
567890 (BIN)
 The values for (S1), (S2) and (D) can be designated between -2147483648 and 2147483647 (BIN 32 bits).
 The judgment of whether data is positive or negative is made by the most significant bit (b31).
b31
Judgment (+/-)
0
Positive
1
Negative
 The following will happen when an underflow or overflow is generated in an operation result:
The carry flag in this case does not go ON.
- By the operation below, b31 is "1" and the result is a negative value.
K-2147483647 (H80000000) - K2 (H0002) = K2147483647 (H7FFFFFFE)
- By the operation below, b31 is "0" and the result is a positive value.
K2147483648 (H7FFFFFFF) - K-2 (HFFFE) = K-2147483646 (H80000001)
 Operation errors
 There are no arithmetic errors associated with the "D+(P)" or "D-(P)" instructions.
 Program example
 The following program adds 28-bit data from X10 to X2B to the data at D9 and D10 when X0 goes ON, and outputs the
result of the operation to Y30 to Y4B.
X0
0
5
 The following program subtracts the data from M0 to M23 from the data at D0 and D1 when XB goes ON, and stores the
result at D10 and D11.
XB
0
5
IB-1501667-B
S2+1
S2
b31
b16
b15
b0
123456 (BIN)
[Ladder mode]
D+P K7X10 D9 K7Y30
END
[Ladder mode]
D-P D0 K6M0 D10
END
D+1
D
b31
b16
b15
b0
444434 (BIN)
Steps
0
1
5
Steps
0
1
5
178
[List mode]
Inst.
Device
LD
X0
D+P
K7X10
D9
K7Y30
END
[List mode]
Inst.
Device
LD
X0B
D-P
D0
K6M0
D10
END

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents