6.2 Arithmetic Operation Instructions
6.2.4 32-bit BIN data multiplication and division
6-31
6
BA
S
IC
INSTRUCTIONS
D*
, D/
D*, D/
D/(P)
(1) Divides the 32-bit BIN data specified for
by the 32-bit BIN data specified for
, and
stores the result to the variable specified for
.
(2) Quotient and remainder of the division result are stored in 64-bit data.
Quotient:
Stored to
[0] (32 bits).
Remainder:
Stored to
[1] (32 bits).
(3) Values can be specified between 2147483648 and 2147483647 (BIN 32 bits) for
and
.
(4) Judgment whether values for
,
,
are positive or negative is made on the basis of the
most significant bit (b31).
(Sign is attached to both the quotient and remainder.)
• 0: Positive
• 1: Negative
O
p
erat
i
on
E
rror
In the following case, an operation error occurs, the error flag (SM0) is turned ON, and the
corresponding error code is stored to SD0.
• Attempt to divide
by 0.
(Error code: 4100)
Program
E
xam
pl
e
(1) In the following program, the BIN value in Var_D7 is multiplied by the BIN value in Var_D18
when X5 turns ON, and the result is stored to Var_D1.
[Structured ladder]
s
1
s
2
d
12
34
56
(BIN)
b
0
b15
56
7890 (BIN)
b
3
1
4 (BIN)
740
66
(BIN)
b16
b
0
b15
b
3
1 b16
b
0
b15
b
3
1 b16
b
0
b15
b
3
1 b16
s
1
s
2
d [
1
]
d [0]
Q
uotient
Remainder
d
d
s
1
s
2
s
1
s
2
d
s
2
Summary of Contents for MELSEC Q Series
Page 1: ...Structured Programming Manual Mitsubishi Programmable Controller QCPU Common Instructions ...
Page 2: ......
Page 14: ...A 12 MEMO ...
Page 340: ...6 178 MEMO MTR ...
Page 708: ...7 368 MEMO ...
Page 776: ...8 68 MEMO ...
Page 796: ...9 20 MEMO ...
Page 804: ...App 8 MEMO ...
Page 812: ...Index 8 MEMO ...
Page 815: ......