6 - 35 6 - 35
MELSEC-Q/QnA
6 BASIC INSTRUCTIONS
DB
-
(1) Subtracts the BCD 8-digit data designated by
S1
and the BCD 8-digit data designated by
S2
,
and stores the result of the subtraction at the device designated by
D
.
+
1023456765 789123
(Upper 4 digits)(Lower 4 digits)
546
+1
+1 +1
Digits higher than those which were
designated will be read as 0.
S1 S1
S2
D DS2
555 55
(Upper 4 digits)(Lower 4 digits) (Upper 4 digits)(Lower 4 digits)
(2) The values for
S1
,
S2
, and
D
can be between 0 to 99999999 (BCD 8 digits).
(3) The following will result if an underflow is generated by the subtraction operation:
The carry flag in this case does not go ON.
21 34567921 345678 99 999999
-
[Operation Errors]
(1) In the following cases an operation error occurs, the error flag (SM0) turns ON, and an error
code is stored at SD0.
• The
S1
,
S2
, or
D
BCD data is outside the 0 to 99999999 range. (Error code: 4100)
[Program Example]
(1) The following program adds the BCD data at D3 and D4 to the BCD data at Z1 and Z2 when
X20 goes ON, and stores the result at R10 and R11.
[Ladder Mode] [List Mode]
Steps
Instruction
Device
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com