6-33
D*(P),D/(P)
1
2
3
4
4
6
7
8
6.2 Arithmetic Operation Instructions
6.2.4 BIN 32-bit multiplication and division operations (D*(P),D/(P))
D/
(1) Divides BIN 32-bit data designated by and BIN 32-bit data designated by , and stores
the result in the device designated by .
(2) With a word device, the division operation result is stored in 64 bits and both the quotient
and remainder are stored. With a bit device, only the quotient is stored as the operation
result in 32 bits.
Quotient : Stored at the lower 32 bits.
Remainder : Stored at the upper 32 bits (Stored only when using a word device).
(3) The values for and can be designated at between 2147483648 and 2147483647
(BIN 32 bits).
(4) Judgment whether values for , , and +2 are positive or negative is made on the
basis of the most significant bit (b31).
(Sign is attached to both the quotient and remainder.)
• 0: Positive
• 1: Negative
Operation Error
(1) In any of the following cases, an operation error occurs, the error flag (SM0) is turned ON,
and the corresponding error code is stored into SD0.
• Attempt to divide by 0. (Error code: 4100)
Program Example
(1) The following program multiplies the BIN data at D7 and D8 by the BIN data at D18 and D19
when X5 is ON, and stores the result at D1 to D4.
[Ladder Mode] [List Mode]
(2) The following program outputs the value resulting when the data at X8 to XF is multiplied by
3.14 to Y30 to Y3F when X3 is ON.
[Ladder Mode] [List Mode]
S1
S2
D
123456 (BIN)
b0b15
567890 (BIN)
b31
4 (BIN) 74066 (BIN)
S1
S2
D D D D
b16
S1
b0b15b31 b16
S2
b0b15b31 b16 b0b15b31 b16
S1
S2
S1
S2
D D
S2
Step
Instruction
Device
Step
Instruction
Device