5 Applied Instructions and Basic Usage
DVP-20PM Application Manual
5-125
API
Applicable model
20PM
175
D
D
DIVR
P
P
Floating-point division
Bit device Word device
X Y M S F H KnX KnY KnM KnS T C D V Z
S1
*
S2
*
D
*
Note: Please refer to specifications for more information about device
ranges.
Only the 32-bit instructions DSUBR and DSUBRP are valid.
16-bit instruction
- - - -
32-bit instruction (13 steps)
DDIVR
Continuity
instruction
DDIVP
Pulse
instruction
Flags
Ox O100
M1808 M1968 Zero flag
M1809 M1969 Borrow flag
M1810 M1970 Carry flag
Please refer to the additional remark below.
Explanation
S
1
and S
2
can be floating-point values.
S
1
: Dividend; S
2
: Divisor; D: Quotient
S
1
and S
2
can be floating-point values (e.g. F1.2), or data registers in which
floating-point values are stored.
If S
1
and S
2
are data registers in which floating-point values are stored, the
function of API 172 DDIVR is the same as the function of API 123 DEDIV.
The floating-point value in S
1
is divided by the floating-point value in S
2
, and
the product is stored in D.
S
1
and S
2
can be the same register. If the instruction DSUBR is used under the
circumstances, the value in the register is divided by itself whenever the
conditional contact is ON in a scan cycle. Generally, the pulse instruction
DDIVRP is used.
If the absolute value of an oepration result is greater than the maximum
floating-point value available, a carry flag will be ON. If the absolute value of an
oepration reuslt is less than the minimum floating-point value available, a
borrow flag will be ON. If an operation result is 0, a zero flag will be ON.
Example 1
When X0 is ON, the floating-point value F1.200E is divided by the
floating-point value F2.200E+0, and the quotient F0.545E+0 is stored in (D11,
D10). (The floating-point value F1.2 is represented by the scientific notation
F1.200E+0 in a ladder diagram. The number of decimal places which are
displayed can be set by means of the View menu in WPLSoft.)
X0
DDIVR F1.200E+0
D10
F2.200E+0
Example 2
When X1 is ON, the floating-point value in (D1, D0) is divided by the
floating-point value in (D11, D10), and the quotient is stored in (D21, D20).
X1
DDIVR
D0 D10 D20