Chapter 6 Instruction Details
XBC E-Type Main Unit
6-164
Ver. 1
6.28.4 DIV, DIVP, DDIV, DDIVP
Instruction
Area Available
Step
Flag
P M K F L T C S Z D.x R.x
Co
nst.
U N D R
Error
(F110)
Zero
(F111)
Carry
(F112)
DIV(P)
DDIV(P)
S1 O O O O O O O - O -
- O O O O O
4~6
O
-
-
S2 O O O O O O O - O -
- O O O O O
D O O O - O O O - O -
-
O O O O
Operand
Description
Data Type
S1
Data to be divided by S2
INT/DINT
S2
Data to be divided by S1
INT/DINT
D
Address to save operation result in
INT/DINT
[Flag Set]
Flag
Description
Device
Number
Error
To be set if S2’s value is 0.
F110
1) DIV (Signed Binary Divide)
(1) Saves the result of word data S1 divided by S2, the quotient in D (16-bit), the remainder in D+1.
(2) At this moment, it performs Signed Operation.
2) DDIV (Signed Binary Double Divide)
(1) Saves the result of word data (S1+1,S1) divided by (S2+1,S2), the quotient in (D+1,D), the remainder in
(D+3,D+2).
(2) If operation result is over 2,147,483,648 (h7FFFFFFF) or below -2,147,483,647(hFFFFFFFF), Carry Flag
will be set.
b0
S2
..
b0
567890 (BIN)
b15
S1
b16
b31
S1+1
123456 (BIN)
b15
b16
b31
S2+1
b0
D+2
b0
4 (BIN)
b15
D
b16
b31
D+1
74066 (BIN)
b15
b16
b31
D+3
3) Program Example
(1) For P1000=’5577’ and P1100=’5’, Input Signal P00000 is changed from Off to On, the quotient ‘1111’ is
saved in P1200 and then the remainder ‘2’ is saved in P1201.
DIV P1000 P1100 P1200
P00000
(D)DIVU
P S1 S2
(D)DIVUP
S1 S2
means
DIV/DDIV
D
D
/
9876
b15
b0
S1
1234
b15
b0
S2
/
8
b15
b0
D quotient
4
b15
b0
D+1 remainder
Summary of Contents for XBC-DN10E
Page 1: ......
Page 10: ...Table of Contents Table of Contents 6 10 10 CLEAR ALL PLC 29...