Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/05/01 19:55
Read: times


 
#15469 - RE: 16bit Hex to BCD conversion
The following routine will solve your problem
;===============================;
; 16 bits Binary to 24 bits BCD ;
;===============================;
; R2:R1=Binary, R6:R5:R4=BCD ;
;-------------------------------;
Bin2Bcd16: ;
push b ;
mov b,#16 ;16 bits
clr a ;
mov r4,a ;Result=0
mov r5,a ;
mov r6,a ;
b2b16: mov a,r1 ;Shift Left binary
rlc a ;
mov r1,a ;
mov a,r2 ;
rlc a ;
mov r2,a ;
mov a,r4 ;Shift Left bcd
addc a,r4 ;
da a ;
mov r4,a ;
mov a,r5 ;
addc a,r5 ;
da a ;
mov r5,a ;
mov a,r6 ;
addc a,r6 ;
da a ;
mov r6,a ;
djnz b,b2b16 ;Repeat 16 times
pop b ;
ret ;
;-------------------------------;


List of 11 messages in thread
TopicAuthorDate
16bit Hex to BCD conversion            01/01/70 00:00      
RE: 16bit Hex to BCD conversion            01/01/70 00:00      
RE: 16bit Hex to BCD conversion            01/01/70 00:00      
RE: 16bit Hex to BCD conversion            01/01/70 00:00      
RE: 16bit Hex to BCD conversion            01/01/70 00:00      
RE: 16bit Hex to BCD conversion            01/01/70 00:00      
RE: 16bit Hex to BCD conversion            01/01/70 00:00      
RE: 16bit Hex to BCD conversion            01/01/70 00:00      
RE: 16bit Hex to BCD conversion            01/01/70 00:00      
RE: 16bit Hex to BCD conversion            01/01/70 00:00      
RE: 16bit Hex to BCD conversion            01/01/70 00:00      

Back to Subject List