6-25
+(P),-(P)
1
2
3
4
4
6
7
8
6.2 Arithmetic Operation Instructions
6.2.1 BIN 16-bit addition and subtraction operations (+(P),-(P))
–
(1) Subtracts 16-bit BIN data designated by from 16-bit BIN data designated by and
stores the result of the subtraction at the device designated by .
(2) Values for , and can be designated between 32768 and 32767 (BIN, 16 bits).
(3) The judgment of whether data is positive or negative is made by the most significant bit
(b15).
• 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 are no operation errors associated with the +(P) or -(P) instruction.
Program Example
(1) The following program adds, when X5 is turned ON, the data at D3 and D0 and outputs the
operation result at Y38 to Y3F.
[Ladder Mode] [List Mode]
(2) The following program outputs the difference between the set value for timer T3 and its
present value in BCD to Y40 to Y53.
[Ladder Mode] [List Mode]
S1
S2
D
b0
5678 (BIN)
b15 b0
4444 (BIN)
b15b0
1234 (BIN)
b15
S1
S2
D
S1
S2
D D
Since bit 15 value is "0",
result of operation takes a positive value.
Since bit 15 value is "1",
result of operation takes a negative value.
K32767
K2
(7FFF
H) (FFFEH)
K 2
(8000
H) (0002H)
K
32767
K3276
6
(7FFE
H)
(8001H)
K 32768
Step
Instruction
Device
Step
Instruction
Device