Mitsubishi Electric M800VW Series Programming Manual page 195

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
-
 Subtracts 16-bit BIN data designated by (S1) from 16-bit BIN data designated by (S2) and stores the result of the subtrac-
tion at the device designated by (D).
S1
b15
b0
5678 (BIN)
 Values for S1, S2, and D can be designated between -32768 and 32767 (BIN 16 bits).
 The judgment of whether data is positive or negative is made by the most significant bit (b15).
b15
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, b15 is "0" and the result is a positive value.
K-32768 (H8000) - K2 (H0002) = K32766 (H7FFE)
- By the operation below, b15 is "1" and the result is a negative value.
K32767 (H7FFF) - K-2 (HFFFE) = K-32767 (H8001)
 Operation errors
 There are no arithmetic errors associated with the "+(P)" or "-(P)" instructions.
 Program example
 The following program adds the contents of D3 and the contents of D0 when X5 goes ON, and outputs result to Y38
through 3F.
X5
0
5
 The following program outputs the difference between the set value for timer T3 and its present value to Y40 to 53 by BCD.
0
M400
5
13
IB-1501667-B
S2
b15
b0
1234 (BIN)
[Ladder mode]
+P D3 D0 K2Y38
END
[Ladder mode]
X3
K18000
T3
- K18000 T3 D3
DBCD D3 K5Y40
END
D
b15
b0
4444 (BIN)
Steps
0
1
5
Steps
0
1
5
6
10
13
174
[List mode]
Inst.
Device
LD
X5
+P
D3
D0
K2Y38
END
[List mode]
Inst.
Device
LD
X3
OUT
T3
K18000
LD
M400
-
K18000
T3
D3
DBCD
D3
K5Y40
END

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents