Chapter 16 PLC Function Applications│CP2000
16-66
API
ADD
S1 S2 D
BIN addition
20
D P
Bit device Word device
16-bit command (7 STEP)
ADD Continuous
execution type
ADDP Pulse
execution type
32-bit command (13 STEP)
DADD Continuous
execution type
DADDP Pulse
execution type
Flag signal: M1020 Zero flag
M1021 Borrow flag
M1022 Carry flag
Please refer to the following
supplementary explanation
X Y M K H KnX KnY KnM T C D
S1
* * * * * * * *
S2
* * * * * * * *
D
* * * * *
Notes on operand usage: none
S1
: Augend.
S2
: Addend.
D
: Sum.
Using two data sources: The result of adding
S1
and
S2
using the BIN
method will be stored in
D
.
The highest bit of any data is symbolized as bit 0 indicating (positive) 1 indicating
(negative), enabling the use of algebraic addition operations. (for instance:
3+(-9)=-6)
Flag changes connected with the addition.
1. When calculation results are 0, the zero flag M1020 will be On.
2. When calculation results are less than –32,768, the borrow flag M1021 will be
On.
3. When calculation results are greater than 32,767, the carry flag M1022 will be
On.
16-bit BIN addition: When X0=On, the result of the content of addend D0 plus the
content of augend D10 will exist in the content of D20.
X0
D0 D10
D20
DD
Relationship between flag actions and negative/positive numbers: