Mitsubishi MELSEC-Q/L Programming Manual page 192

Table of Contents

Advertisement

+, +P, -, -P
(1) Subtracts 16-bit BIN data designated by
at the device designated by
(2) Values for
,
and
S1 S2
D
(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.
K 32768
K2
(8000
)
(0002
)
H
H
K32767
K 2
(7FFF
) (FFFE
)
H
H
Operation Error
(1)
There is no operation error in 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]
(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]
190
from 16-bit BIN data designated by
S1
.
D
S1
b15
b0
b15
5678 (BIN)
can be designated between
Since bit 15 value is "0",
K32766
(7FFE
)
result of operation takes a positive value.
H
Since bit 15 value is "1",
K 32767
(8001
)
result of operation takes a negative value.
H
[List Mode]
Step
[List Mode]
Step
S2
S2
D
b0
b15
1234 (BIN)
4444 (BIN)
-32768 and 32767 (BIN, 16 bits).
D
Instruction
Device
Instruction
Device
and stores the result of the subtraction
b0

Advertisement

Table of Contents
loading

Table of Contents