6 - 37 6 - 37
MELSEC-Q/QnA
6 BASIC INSTRUCTIONS
(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
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 9999 range. (Error code: 4100)
• Attempt to divide
S2
by 0. (Error code: 4100)
[Program Example]
(1) The following program multiplies the BCD data at X0 to XF and the BCD data at D8 when X0B
goes ON, and stores the result at D0 and D1.
[Ladder Mode] [List Mode]
Steps
Instruction
Device
Multiplication result
482868427953
D8 D1(Upper 4 digits)
XF- - - - - - - - - - X0
4526
D0(Lower 4 digits)
Multiplie
Multiplicand
(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]
Steps
Instruction
Device
Quotient
000421346578
D502
7042
D503
0004
Y3F- - - - - - - - -Y30
Quotient
Remainder
/
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com