6 - 39 6 - 39
MELSEC-Q/QnA
6 BASIC INSTRUCTIONS
DB/
(1) Divides 8-digit BCD data designated by
S1
and 8-digit BCD data designated by
S2
, and stores
the result in the device designated by
D
.
6578 192 130235467
+1
0000 0045 1023 6308
Digits higher than those which were
designated will be read as 0.
(Lower 4 digits)(Upper 4 digits)(Lower 4 digits)(Upper 4 digits) Remain-
der
Quotient
+1
S1
S2
+1
D
S1 S2
D
+3
D
+2
D
/
(2) 64 bits are used for the result of the division operation, and stored as quotient and remainder.
Quotient (BCD 8 digits) .................. Stored at the lower 32 bits
Remainder (BCD 8 digits) .................. Stored at the upper 32 bits
(3) If
D
has been designated as a bit device, the remainder of the operation will not be stored.
[Operation Errors]
(1) In the following cases an operation error occurs, the error flag (SM0) turns ON, and an error
code is stored at SD0.
• The
S1
or
S2
data is outside the 0 to 99999999 range. (Error code: 4100)
• Attempt to divide
S2
by 0. (Error code: 4100)
[Program Example]
(1) The following program multiplies the BCD data 67347125 and 573682, stores the result from
D502 to D505, and at the same time outputs the upper 8 digits to Y30 to Y4F.
[Ladder Mode] [List Mode]
Steps
Instruction
Device
Y4F- - - - - - - - - -Y30
Multiplicand
Multiplier
8634 7 1 2 5
0057 3 6 8 2
0039
2
0 9 5
0
D505
039 0
D504
295 5
D503
136 2
D502
450
(2) The following program divides the BCD data from X20 to 3F by the BCD data at D8 and D9
when X0B goes ON, and stores the result from D765 to D768.
[Ladder Mode] [List Mode]
Steps
Instruction
Device
Divider
5 26
D9(Upper 4 digits)
7348
D8(Lower 4 digits)
9986
X3F- - - - - - - - - - - - - - - - - - - - - - -X20
Multiplicand
432 11
Quotient
0000 0006 8028 8133
(Lower 4 digits)(Upper 4 digits)
D766 D765
(Lower 4 digits)
D767
(Upper 4 digits)
D768
Remainder
/
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com