6 - 25 6 - 25
MELSEC-Q/QnA
6 BASIC INSTRUCTIONS
/
(1) Divides BIN 16-bit data designated by
S1
and BIN 16-bit data designated by
S2
, and stores the
result in the device designated by
D
.
1234 (BIN)5678 (BIN)
b15- - - - - - - - - b0
4 (BIN)
Quotient
b15- - - - b0
+1
742 (BIN)
Remainder
S1
S2
D D
b15- - - - - - - - - b0
b15- - - - b0
(2) If a word device has been used, the result of the division operation is stored as 32 bits, and
both the quotient and remainder are stored; if a bit device has been used, 16 bits are used and
only the quotient is stored.
Quotient .......... Stored at the lower 16 bits
Remainder...... Stored at the higher 16 bits
(Can be stored only when a word device has been used)
(3) The values for
S1
,
S2
, and
D
can be designated at between -32768 and 32767 (BIN 16 bits).
(4) Judgment whether values for
S1
,
S2
, and
D
are positive or negative is made on the basis of
the most significant bit (b15 for
S1
and
S2
, and b15 for
D
).
• 0 ....... Positive
• 1 ....... Negative
[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.
• Attempt to divide
S2
by 0. (Error code: 4100)
[Program Example]
(1) The following program divides "5678" by "1234" when X5 goes ON, and stores the result at D3
and D4.
[Ladder Mode] [List Mode]
Steps
Instruction
Device
(2) The following program divides BIN data at X8 to XF by BIN data at X10 to X1B, and outputs
the result of the division operation to Y30 to Y3F.
[Ladder Mode] [List Mode]
Steps Instruction
Device
(3) The following program outputs the value resulting when the data at X8 to XF is divided by 3.14
to Y30 to Y3F when X3 is ON.
[Ladder Mode] [List Mode]
Device
Instruction
Steps
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com