Mitsubishi MELSEC QCPU Programming Manual page 174

Programmable logic controller
Table of Contents

Advertisement

6 BASIC INSTRUCTIONS
D -
(1) Subtracts 32-bit BIN data designated by
the result of the subtraction at the device designated by
(2) The values for
(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 Errors]
(1) There are no operation errors associated with the +(P) or -(P) instructions.
[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]
(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]
6 - 23
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com
+1
S1
S1
S2
b31- -b16 b15- -b0
b31- -b16 b15- -b0
-
567890 (BIN)
123456 (BIN)
,
, and
can be designated at between -2147483648 and 2147483647
D
S1
S2
• K-2147483648
-K2
(H80000000)
(H2)
• K2147483647
-K-2
(H7FFFFFFF)
(HFFFE)
from 32-bit BIN data designated by
S1
.
D
+1
+1
D
S2
b31- -b16 b15- -b0
444434 (BIN)
K2147483646........Because b31 is 0,
(H7FFFFFFE)
the value is positive.
K-2147483647.......Because b31 is 1,
(HFFFE)
the value is negateve.
[List Mode]
Steps
Instruction
[List Mode]
Steps
Instruction
MELSEC-Q/QnA
and stores
S2
D
Device
Device
6 - 23

Advertisement

Table of Contents
loading

This manual is also suitable for:

Melsec qnacpuMelsec q modeMelsec q series

Table of Contents