Omron C200HX Computer Hardware User Manual


 
228
5-19 BCD Calculations
The BCD calculation instructions INC(38), DEC(39), ADD(30), ADDL(54),
SUB(31), SUBL(55), MUL(32), MULL(56), DIV(33), DIVL(57), FDIV(79), and
ROOT(72) all perform arithmetic operations on BCD data.
For INC(38) and DEC(39) the source and result words are the same. That is, the
content of the source word is overwritten with the instruction result. All other
instructions change only the content of the words in which results are placed,
i.e., the contents of source words are the same before and after execution of any
of the other BCD calculation instructions.
STC(40) and CLC(41), which set and clear the carry flag, are included in this
group because most of the BCD operations make use of the Carry Flag (CY) in
their results. Binary calculations and shift operations also use CY.
The addition and subtraction instructions include CY in the calculation as well as
in the result. Be sure to clear CY if its previous status is not required in the cal-
culation, and to use the result placed in CY, if required, before it is changed by
execution of any other instruction.
5-19-1 INCREMENT INC(38)
Wd: Increment word (BCD)
IR, SR, AR, DM, HR, LR
Ladder Symbols Operand Data Areas
INC(38)
Wd
@INC(38)
Wd
Description When the execution condition is OFF, INC(38) is not executed. When the execu-
tion condition is ON, INC(38) increments Wd, without affecting Carry (CY).
Flags ER: Wd is not BCD
Indirectly addressed DM word is non-existent. (Content of DM word is
not BCD, or the DM area boundary has been exceeded.)
EQ: ON when the incremented result is 0.
5-19-2 DECREMENT DEC(39)
Wd: Decrement word (BCD)
IR, SR, AR, DM, HR, LR
Ladder Symbols Operand Data Areas
DEC(39)
Wd
@DEC(39)
Wd
Description When the execution condition is OFF, DEC(39) is not executed. When the
execution condition is ON, DEC(39) decrements Wd, without affecting CY.
DEC(39) works the same way as INC(38) except that it decrements the value
instead of incrementing it.
Flags ER: Wd is not BCD
Indirectly addressed DM word is non-existent. (Content of DM word is
not BCD, or the DM area boundary has been exceeded.)
EQ: ON when the decremented result is 0.
BCD Calculations Section 5-19