BCD Calculations
5-17-5
BCD ADD – ADD(30)
Description
Flags
Example
TR 0
00002
25504
25504
160
When the execution condition is OFF, CLC(41) is not executed.When the ex-
ecution condition is ON, CLC(41) turns OFF CY (SR 25504).
Ladder Symbols
ADD(30)
@ADD(30)
Au
Ad
R
When the execution condition is OFF, ADD(30) is not executed. When the
execution condition is ON, ADD(30) adds the contents of Au, Ad, and CY,
and places the result in R. CY will be set if the result is greater than 9999.
Au + Ad + CY
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.
If 00002 is ON, the program represented by the following diagram clears CY
with CLC(41), adds the content of LR 25 to a constant (6103), places the re-
sult in DM 0100, and then moves either all zeros or 0001 into DM 0101 de-
pending on the status of CY (25504). This ensures that any carry from the
last digit is preserved in R+1 so that the entire result can be later handled as
eight-digit data.
DM 0100
MOV(21)
DM 0101
DM 0101
Although two ADD(30) can be used together to perform eight-digit BCD addi-
tion, ADDL(54) is designed specifically for this purpose.
IR, SR, AR, DM, HR, TC, LR, #
Au
IR, SR, AR, DM, HR, TC, LR, #
Ad
R
CY
R
Address Instruction
00000
CLC(41)
00001
00002
00003
ADD(30)
LR 25
#6103
00004
00005
#0001
00006
00007
MOV(21)
00008
#0000
Section 5-17
Operand Data Areas
Au: Augend word (BCD)
Ad: Addend word (BCD)
R: Result word
IR, AR, DM, HR, LR
Operands
LR
00002
OUT
TR
CLC(41)
AND(30)
LR
#
6103
DM
0100
AND
25504
MOV(21)
#
0001
DM
0101
LD
TR
AND NOT
25504
MOV(21)
#
0000
DM
0101
0
25
0
Need help?
Do you have a question about the SYSMAC C2000H and is the answer not in the manual?