6 - 19 6 - 19
MELSEC-Q/QnA
6 BASIC INSTRUCTIONS
-
(1) Subtracts 16-bit BIN data designated by
S1
from 16-bit BIN data designated by
S2
and stores
the result of the subtraction at the device designated by
D
.
5678 (BIN)
b15- - - - - - - - -b0
4444 (BIN)1234 (BIN)
S2
D
S1
-
b15- - - - - - - - -b0 b15- - - - - - - - -b0
(2) Values for
S1
,
S2
and
D
can be designated from -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.
• K32767
-K2
H7FFF
-K-2
(H8000) (H0002)
K-32767......A negative value is generated if b15 is 1.
K32766.......A positive value is generated if b15 is 0.
(H7FFE)
H8001
H0002
• K-32768
[Operation Errors]
(1) There are no operation errors associated with the +(P) or -(P) instructions.
[Program Example]
(1) The following program adds the contents of D3 and the contents of D0 when X5 goes ON, and
outputs result to Y38 to Y3F.
[Ladder Mode] [List Mode]
Steps
Instruction
Device
(2) The following program outputs the difference between the set value for timer T3 and its
present value to Y40 to Y53.
[Ladder Mode] [List Mode]
Steps
Instruction
Device
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com