6-39
DB+(P),DB-(P)
1
2
3
4
4
6
7
8
6.2 Arithmetic Operation Instructions
6.2.6 BCD 8-digit addition and subtraction operations (DB+(P),DB-(P))
(2) 0 to 99999999 (BCD 8 digits) can be assigned to and .
(3) The following will result if an underflow is generated by the subtraction operation: The carry
flag in this case does not go ON.
Operation Error
(1) In the following case, an operation error occurs, the error flag (SM0) turns ON, and an error
code is stored into SD0.
• The or BCD data is outside the 0 to 99999999 range. (Error code: 4100)
Program Example
(1) The following program adds the BCD data 12345600 and 34567000, stores the result at
D887 and D888, and at the same time outputs them to from Y30 to Y4F.
[Ladder Mode]
[List Mode]
(2) The following program subtracts the BCD data 98765432 from 12345678, stores the result
at D100 and D101, and at the same time outputs it from Y30 to Y4F.
[Ladder Mode]
[List Mode]
S
D
21 34567921345678 99 999999
S
D
Stores 12345600 in BCD to D887 and D888.
Adds 34567000 in BCD to the value in D887 and D888,
and stores the result to D887 and D888.
Outputs the data in D887 and D888 to Y30 to Y4F.
Step
Instruction
Device
Stores 98765432 in BCD to D100 and D101.
Subtracts the value in D100 and D101 from 12345678
in BCD, and stores the result to D100 and D101.
Outputs the data in D100 and D101 to T30
to Y4F.
Step
Instruction
Device