193
D+, D+P, D-, D-P
1
2
3
4
6
7
8
6.2
A
rithmetic Opera
tion In
str
uctions
6.2.2
D
+, D+P, D-
, D-P
D-
(1) Subtracts 32-bit BIN data designated by from 32-bit BIN data designated by and stores the result of the subtraction
at the device designated by .
(2) The values for , and can be designated at between -2147483648 and 2147483647 (BIN 32 bits).
(3) Judgment of whether the data is positive or negative is made on the basis of the most significant bit (b31).
• 0: Positive
• 1: Negative
(4) The following will happen when an underflow or overflow is generated in an operation result:
The carry flag in this case does not go ON.
Operation Error
(1) There is no operation error in the D+(P) or D-(P) instruction.
Program Example
(1) The following program adds 28-bit data from X10 to X2B to the data at D9 and D10 when X0 goes ON, and outputs the
result of the operation to Y30 to Y4B.
[Ladder Mode]
[List Mode]
(2) The following program subtracts the data from M0 to M23 from the data at D0 and D1 when XB goes ON, and stores the
result at D10 and D11.
[Ladder Mode]
[List Mode]
S1
S2
D
123456
(
BIN
)
b0
b16 b15
+1
567890
(
BIN
)
b31
+1
444434
(
BIN
)
+1
S1
S2
D
S1
S2
D
b0
b16 b15
b31
b0
b16 b15
b31
S1
S2
D
S
i
nce
b
i
t
31
va
l
ue
i
s
"
0
",
resu
l
t
of
operat
i
on
ta
k
es
a
pos
i
t
i
ve
va
l
ue
.
S
i
nce
b
i
t
31
va
l
ue
i
s
"
1
",
resu
l
t
of
operat
i
on
ta
k
es
a
negat
i
ve
va
l
ue
.
K
21
4
7
4
836
4
8
(
80000000
H
)
K
21
4
7
4
836
4
7
(
7
FFFFFFF
H
)
K
2
(
00000002
H
)
K
2
(FFFFFFFE
H
)
K
21
4
7
4
836
4
6
K
21
4
7
4
836
4
7
(
80000001
H
)
(
7
FFFFFFE
H
)
Step
Instruction
Device
Step
Instruction
Device