
Chapter 5. Application instructions
5-52
5.8.5
DIV, DIVP, DDIV, DDIVP
DIV
(Binary divide)
FUN(124) DIV
FUN(126) DDIV
FUN(125) DIVP
FUN(127) DDIVP
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
DIV(P)
DDIV(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
-
DIV(P) : Performs the division of BIN data specified as [ S1 ] and the BIN 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 ].
-
DDIV(P) : Performs the division of BIN data specified as [ S1+1, S ] and the BIN data specified as
[ S2+1, S2 ], and stores the division 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 address specified by #D format is out of device range or the content of divider is 0, the
operation error occurs and the error flag (F110) is set.
-
Execution conditions
Operand setting
DIV
DIVP
DDIV
DDIVP
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
Input condition
DIV, DDIV
DIVP, DDIVP
Executed only once
Executed only once
Executed per scan
Executed per scan