Chapter 16 PLC Function Applications│CP2000
16-69
API
DIV
S1 S2 D
BIN division
23
D P
Bit device Word device
16-bit command (7 STEP)
DIV Continuous
execution type
DIVP Pulse
execution type
32-bit command (13 STEP)
DDIV Continuous
execution type
DDIVP Pulse
execution type
Flag signal: none
X Y M K H KnX KnY KnM T C D
S1
* * * * * * * *
S2
* * * * * * * *
D
* * * * *
Notes on operand usage:
The 16-bit command operand D will occupy 2 consecutive points
S1
: Dividend.
S2
: Divisor.
D
: Quotient and remainder.
Using two data sources: The quotient and remainder will be stored in
D
when
S1
and
S2
are subjected to division using the BIN method. The sign bit for
S1
,
S2
and
D
must be kept in mind when performing a 16-bit operation.
16-bit BIN division:
If
D
is a bit device, K1–K4 can be designated 16 bits, which will occupy 2
consecutive units and yield the quotient and remainder.
When X0=On, the quotient resulting from division of dividend D0 by divisor D10
will be placed in D20, and the remainder will be placed in D21. Whether the
highest bit is Off or On will indicate the sign of the result.
X0
D0 D10
D20
DIV
D0 D10
K4Y0
DIV