Mitsubishi MELSEC QCPU Programming Manual page 188

Programmable logic controller
Table of Contents

Advertisement

6 BASIC INSTRUCTIONS
(2) Uses 32 bits to store the result of the division as quotient and remainder
Quotient
Remainder (BCD 4 digits) .................. Stored at the upper 16 bits
(3) If
has been designated as a bit device, the remainder of the operation will not be stored.
D
[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
• Attempt to divide
[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]
XF- - - - - - - - - - X0
9
7
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]
5
6
6 - 37
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com
(BCD 4 digits) .................. Stored at the lower 16 bits
or
data is outside the 0 to 9999 range. (Error code: 4100)
S2
by 0. (Error code: 4100)
S2
D8
5
3
8
6
4
Multiplie
7
8
/
1
2
3
[List Mode]
Steps
Instruction
D1(Upper 4 digits)
2
8
4
2
8
Multiplication result
[List Mode]
Steps
Instruction
D502
4
0
0
0
4
Quotient
Y3F- - - - - - - - -Y30
0
0
0
Quotient
MELSEC-Q/QnA
Device
D0(Lower 4 digits)
5
4
2
6
Device
D503
0
7
4
2
Remainder
4
6 - 37

Advertisement

Table of Contents
loading

This manual is also suitable for:

Melsec qnacpuMelsec q modeMelsec q series

Table of Contents