> Jinx's post is a completion (separating the 10s from the 1s) of > http://www.piclist.com/techref/microchip/math/radix/b2bhp-8b3d.htm > by Scott Dattalo I should have attributed that The 16-bit convertor is pretty wizard too http://www.piclist.com/techref/microchip/math/radix/b2a-16b5a-rl.htm Both the 8-bit and 16-bit are used extensively for LCD, no problems (note gotos if porting to 18F) ;================================================ ; Convert 16-bit data to ASCII ;================================================ ;Input 16-bit number in hi:lo ;Output 5-byte ASCII array ascii16 nop radix dec ;base 10 movf fsr,w ;save fsr movwf f_temp clrf known_zero clrf temp movlw dg1 movwf fsr goto $+2 sub10k incf temp movlw 10000 & 255 subwf lo IFNDEF known_zero movlw 10000>>8 skpc movlw (10000>>8)+1 subwf hi ELSE rlf known_zero,w sublw (10000>>8)+1 subwf hi ENDIF bc sub10k call out_temp movlw 10 movwf temp add1K decf temp movlw 1000 & 255 addwf lo IFNDEF known_zero movlw 1000 >> 8 skpnc movlw (1000>>8)+1 addwf hi ELSE rlf known_zero,w addlw 1000>>8 addwf hi ENDIF bnc add1k call out_temp clrf temp movlw 100 goto $+2 sub100 incf temp subwf lo skpnc goto sub100 decf hi btfss hi,7 goto sub100 call out_temp movlw 10 movwf temp add10 decf temp addwf lo bnc add10 call out_temp ;convert and store call out_lo ;convert and store movf f_temp,w ;restore fsr movwf fsr radix hex return ;convert to ASCII and store out_temp movf temp,w addlw 0x30 movwf indf incf fsr return out_lo movf lo,w addlw 0x30 movwf indf return -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist