Mitsubishi MELSEC QCPU Programming Manual page 170

Programmable logic controller
Table of Contents

Advertisement

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

Advertisement

Table of Contents
loading

This manual is also suitable for:

Melsec qnacpuMelsec q modeMelsec q series

Table of Contents