[an error occurred while processing this directive]
[an error occurred while processing this directive]
|
;
; ** BinToBCD -- the routine to convert 8 bit binary number to a 2 digit BCD number
;
BinToBCD:
CLR R17 ; Set ten counter
?0005:
CPI R16, 10 ; See if the value is less then 10
BRCS ?0004 ; Branch if YES
SUBI R17, -16 ; Bump ten counter
SUBI R16, 10 ; Subtract 10
RJMP ?0005 ; Loop
?0004:
OR R16,R17 ; Combine high and low BCDs
RET
E-mail: info@telesys.ru