Omron C200HS Garage Door Opener User Manual


 
207
Flags ER: Au and/or Ad 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.)
CY: ON when there is a carry in the result.
EQ: ON when the result is 0.
Example When 00000 is ON, the following program adds two 12-digit numbers, the first
contained in LR 20 through LR 22 and the second in DM 0012. The result is
placed in LR 10 through HR 13. In the second addition (using ADD(30)), any
carry from the first addition is included. The carry from the second addition is
placed in HR 13 by using @ADB(50) (see
5-20-1 BINARY ADD – ADB(50)
) with
two all-zero constants to indirectly place the content of CY into HR 13.
@ADDL(54)
LR 20
DM 0010
HR 10
CLC(41)
00000
@ADD(30)
LR 22
DM 0012
HR 12
@ADB(50)
#0000
#0000
HR 13
Address Instruction Operands
00000 LD 00000
00001 CLC(41)
00002 @ADDL(54)
LR 20
DM 0010
HR 10
00003 @ADD(30)
LR 22
DM 0012
HR 12
00004 @ADB(50)
# 0000
# 0000
HR 13
5-19-7 BCD SUBTRACT – SUB(31)
Mi: Minuend word (BCD)
IR, SR, AR, DM, HR, TC, LR, #
Su: Subtrahend word (BCD)
IR, SR, AR, DM, HR, TC, LR, #
Ladder Symbols
Operand Data Areas
R: Result word
IR, SR, AR, DM, HR, LR
SUB(31)
Mi
Su
R
@SUB(31)
Mi
Su
R
Description When the execution condition is OFF, SUB(31) is not executed. When the exe-
cution condition is ON, SUB(31) subtracts the contents of Su and CY from Mi,
and places the result in R. If the result is negative, CY is set and the 10’s comple-
ment of the actual result is placed in R. To convert the 10’s complement to the
true result, subtract the content of R from zero (see example below).
Mi Su CY CY R
Note The 2’s COMPLEMENT – NEG(––) instruction can be used to convert binary
data only, it cannot be used with BCD data.
BCD Calculations Section 5-19