5 - 32
5.4 Arithmetic Operation Instruction
Project name QB-16
Program name MAIN
5.4.1 +(P) BIN 16-bit data addition
-(P)
BIN 16-bit data subtraction
S2
X2
0
D
S
D0K5+P
X3
4
D1K100D0+P
D
S1
1
2
1
● Every time the input condition is turned on, the content of the device specified in
D
is added to the content of the device specified in
S
and the result is stored in
the device specified in
D
.
D
D0
+
S
(5)
→
D
D0
(Input condition)
First ON
Second ON
Third ON
0 (example)
5
10
+
+
+
5
5
5
→
→
→
5
10
15
The content of
D0 is changed.
2
● When the input condition is turned on, the content of the device specified in
S1
is
added to the content of the device specified in
S2
and the result is stored in the
device specified in
D
.
S1
D0
+
S2
(100)
→
D
D1
(Input condition)
ON
15 (example)
+
100
→
115
The content of D0 is not changed.
CAUTION
• +P or -P must be used for the addition or subtraction instructions.
• When +
or - is used, an addition or subtraction operation is executed every
scanning. To use +
or - , operands must be converted into pulse in advance.
D0K5+P
X2
M0PLS
X2
D0K5+
M0
REFERENCE
• The following two instructions work on the same principle in the addition or subtraction
operation.
D0K1+P
D2K1-P
(Addition)
(Subtraction)
D0INCP
D2DECP