
Chapter 5. Application instructions
5-62
5.9.4
DIVB, DIVBP, DDIVB, DDIVBP
DIVB
(BCD divide)
FUN(144) DIVB
FUN(146) DDIVB
FUN(145) DIVBP
FUN(147) DDIVBP
Applicable
CPU
All CPUs
Available Device
Flag
Instructions
M
P
K
L
F
T
C
S
D
#D Integer
Steps
Error
(F110)
Zero
(F111)
Carry
(F112)
O O O O O O O
O
O
O
O O O O O
O
O
O
O
O
DIVB(P)
DDIVB(P)
O O O O*
O O
O O
7/9/11
O
O
* Available only when do not use computer link module or data link module
1) Functions
-
DIVB(P) : Performs the division of BCD data specified as [ S1 ] and the BCD data specified as
[ S2 ], and stores the division result into the device specified as [ D+1, D ]. The quotient is stored at
[ D ], and the remainder is stored at [ D+1 ].
-
DDIVB(P) : Performs the multiplication of BCD data specified as [ S1+1, S ] and the BCD data
specified as [ S2+1, S2 ], and stores the multiplication result into the device specified as [ D+3, D+2,
D+1, D ]. The quotient is stored at [ D+1, D ], and the remainder is stored at [ D+3, D+2 ].
-
If the quotient is zero, the zero flag will be set.
-
If indirect ad dress specified by #D format is out of device range or the content of divider is 0 or
contents of [ S1 ] and [ S2 ] is invalid BCD format (out of 0 ~ 9), the operation error occurs and the
error flag (F110) is set.
Operand setting
DIVB
DIVBP
DDIVB
DDIVBP
S1
S1
S2
S2
S1
S2
D
D
D
The device storing dividend
The device at which the
division result is stored
S1
S2
D
The device storing divider