6.2 Arithmetic Operation Instructions
6.2.1 16-bit BIN data addition and subtraction
6-23
6
BA
S
IC
INSTRUCTIONS
+
, -
+, -
(3) The judgment of whether the value is positive or negative is made by the most significant bit
(b15).
• 0: Positive
• 1: Negative
(4) The following is the result when an underflow or overflow is generated by the operation.
The carry flag in this case does not turn ON.
-(P)
(1) Subtracts 16-bit BIN data specified for
from 16-bit BIN data for
and stores the result of
the subtraction to the variable specified for
.
(2) Values can be specified between
32768 and 32767 (BIN 16 bits) for
,
and
.
(3) The judgment of whether the value is positive or negative is made by the most significant bit
(b15).
• 0: Positive
• 1: Negative
(4) The following is the result when an underflow or overflow is generated by the operation.
The carry flag in this case does not turn ON.
O
p
erat
i
on
E
rror
No operation error occurs in the execution of the +(P) and -(P) instructions.
Program
E
xam
pl
e
In the following program, the value in Var_D3 is added to the value in Var_D0 when X5 turns ON,
and outputs the result to Var_D3.
[Structured ladder]
3
2
7
6
7
+
2
+
2
3
2
7
6
7
Since
b
it
15
value is "
1
",
result o
f
o
p
eration takes a negative value.
3
2
7
66
Since
b
it
15
value is "0",
result o
f
o
p
eration takes a
p
ositive value.
3
2
7
6
8
(7FFF
H
)
(8000
H
)
(000
2
H
)
(FFFE
H
)
(7FFE
H
)
(800
1
H
)
s
1
s
2
d
b
0
56
78
(B
IN
)
b15
b
0
4444
(B
IN
)
b15
b
0
12
3
4
(B
IN
)
b15
s
1
s
2
d
d
s
1
s
2
d
・
3
2
7
6
7
2
(7
FFF
H
)
2
(8000
H
)
(000
2
H
)
3
2
7
6
7
……
S
i
nce
bi
t
15
va
l
ue
i
s
"1"
,
resu
l
t
o
f
o
p
erat
i
on
takes
a
negat
i
ve
va
l
ue
.
3
2
7
66
………
S
i
nce
bi
t
15
va
l
ue
i
s
"
0
"
,
resu
l
t
o
f
o
p
erat
i
on
takes
a
p
os
i
t
i
ve
va
l
ue
.
(7
FFE
H
)
( 800
1
H
)
(
FFFE
H
)
・
3
2
7
6
8
Summary of Contents for MELSEC Q Series
Page 1: ...Structured Programming Manual Mitsubishi Programmable Controller QCPU Common Instructions ...
Page 2: ......
Page 14: ...A 12 MEMO ...
Page 340: ...6 178 MEMO MTR ...
Page 708: ...7 368 MEMO ...
Page 776: ...8 68 MEMO ...
Page 796: ...9 20 MEMO ...
Page 804: ...App 8 MEMO ...
Page 812: ...Index 8 MEMO ...
Page 815: ......