Mitsubishi Electronics 13JW55 ユーザーズマニュアル

ページ / 350
 
 
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
D0
K5
+P
X3
4
D1
K100
D0
+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)

10 
 


 


 
→ 
→ 
→ 
 
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. 
D0
K5
+P
X2
M0
PLS
X2
D0
K5
+
M0
 
 
REFERENCE  
•  The following two instructions work on the same principle in the addition or subtraction 
operation. 
D0
K1
+P
D2
K1
-P
(Addition)
(Subtraction)
D0
INCP
D2
DECP