205
B*, B*P, B/, B/P
1
2
3
4
6
7
8
6.2
A
rithmetic Opera
tion In
str
uctions
6.2.7
B
*, B
*P, B/, B/P
B/
(1) Divides BCD data designated by and BCD data designated by , and stores the result in the device designated by .
(2) Uses 32 bits to store the result of the division as quotient and remainder
Quotient (BCD 4 digits)
:Stored at the lower 16 bits.
Remainder (BCD 4 digits) :Stored at the upper 16 bits.
(3) If has been designated as a bit device, the remainder of the operation will not be stored.
Operation Error
(1) In any of the following cases, an operation error occurs, the error flag (SM0) turns ON, and an error code is stored into
SD0.
Program Example
(1) The following program multiplies, when X20 is turned ON, the BCD data at X0 to XF by the BCD data at D8 and stores
the operation result at D0 to D1.
[Ladder Mode]
[List Mode]
[Operation]
(2) The following program divides 5678 by the BCD data 1234, stores the result at D502 and D503, and at the same time
outputs the quotient to Y30 to Y3F.
[Ladder Mode]
[List Mode]
[Operation]
Error
code
Error details
Q00J/
Q00/
Q01
QnH
QnPH QnPRH
QnU
LCPU
4100
The or BCD data is outside the 0 to 9999 range.
The divisor is 0.
S1
S2
D
0
0
0
6
8
0
7
6
6
5
7
8
4
0
2
2
+1
(
Remainder
)
(Q
uotient
)
S1
S2
D
D
Digits exceeding the designated number of digits are
assumed to be 0.
/
D
S1
S2
Step
Instruction
Device
Multiplication result
4
8
2
8
6
8
4
2
7
9
5
3
D8
D1
(U
pper 4 digits
)
X0
XF
4
5
2
6
D0
(
Lower 4 digits
)
Multiplier
Multiplicand
Step
Instruction
Device
/
0
0
0
4
2
1
3
4
6
5
7
8
D502
7
0
4
2
D503
0
0
0
4
Y30
Y3F
Q
uotient
Remainder
Q
uotient