[an error occurred while processing this directive]
|
hex2bcd: ;hex to bcd conversion r1,r2 input,output, max input 0x270f
clr temp
clr temp1
ldi temp2,16
hex2bcd_loop:
rol r2
rol r1
rol temp1
rol temp
dec temp2
brne hex2bcd1
mov r2,temp1
mov r1,temp
ret
hex2bcd1:
subi temp,-3
sbrs temp,3
subi temp,3
subi temp,-0x30
sbrs temp,7
subi temp,0x30
subi temp1,-3
sbrs temp1,3
subi temp1,3
subi temp1,-0x30
sbrs temp1,7
subi temp1,0x30
rjmp hex2bcd_loop
E-mail: info@telesys.ru