How can i modify this Asm file to give me a 5 files digit, TENK, THOU, HUNS,TENS, UNITS
for an 18f2321
for an 18f2321
Rich (BB code):
LEFT JUSTIFIED, UPPER 8 BITS IN ADRESH, LOWER 2 BITS IN ADRESL
swapf bcdH,w ; unpack BCD digits
andlw 0x0F
movwf thou
movf bcdH,w
andlw 0x0F
movwf huns
swapf bcdL,w
andlw 0x0F
movwf tens
movf bcdL,w
andlw 0x0F
movwf ones
goto $
;-------------------------------
;
; Upper 10-bit Binary To Packed BCD Digits
;
Bin10ToBCD4
clrf bcdL ; clear result
clrf bcdH
movlw .10 ; set bit counter
movwf count
bcd_lp movlw 0x33 ; adjust BCD result
addwf bcdL
btfsc bcdL,3
andlw 0xF0
btfsc bcdL,7
andlw 0x0F
subwf bcdL
movlw 0x03
addwf bcdH
btfss bcdH,3
subwf bcdH
rlf binL ; shift out a binary bit
rlf binH
rlf bcdL ; into BCD result
rlf bcdH
decfsz count ; repeat for all bits
goto bcd_lp
return ; exit