EasyManua.ls Logo

Mitsubishi Electric MELSEC-Q/L - Page 231

Mitsubishi Electric MELSEC-Q/L
1084 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
6 BASIC INSTRUCTIONS
6.2 Arithmetic Operation Instructions
229
6
/
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).
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.
Values for (S1) and (S2) can be specified between the range of -32768 and 32767 (BIN 16 bits).
Judgment whether values for (S1), (S2), (D) and (D)+1 are positive or negative is made on the basis of the most significant
bit (b15). (Sign is attached to both the quotient and remainder.)
Operation error
In any of the following cases, an operation error occurs, the error flag (SM0) turns ON, and an error code is stored into SD0.
Program example
The following program multiplies "5678" by "1234" in BIN and stores the result at D3 and D4 when X5 turns ON.
The following program multiplies BIN data at X8 to XF by BIN data at X10 to X1B, and outputs the result of the multiplication
to Y30 to Y3F.
The following program divides, when X3 is turned ON, the data at X8 to XF by 3.14 and outputs the operation result at Y30
to Y3F.
Quotient  Stored at the lower 16 bits.
Remainder  Stored at the upper 16 bits (Stored only when using a word device).
•0  Positive
•1  Negative
Error
code
Error details Q00J/
Q00/
Q01
QnH QnPH QnPRH QnU LCPU
4100 The divisor is 0. 
[Ladder Mode] [List Mode]
[Ladder Mode] [List Mode]
[Ladder Mode] [List Mode]
b0
5678 (BIN) 1234 (BIN)
b15
4 (BIN)
Quotient
b15 b0
742 (BIN)
Remainder
b15 b0
S1
S2
D
D
b0
b15
1
Step
Instruction
Device
Step
Instruction
Device
Step
Instruction
Device

Table of Contents

Related product manuals