fhex db "0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"
;****************************************************************
; fixhex - subroutine takes byte passed in W - splits it into two
; ascii bytes representing hex digits and outputs them to RS232
fixhex movwf temp ;store it for later
movwf dec1 ;and put it in dec1 too
movlw 0xf0 ;mask out low nybble
andwf dec1
swapf dec1 ;swap nybbles
movlw fhex ;point W to table start
addwf dec1 ;add offset to desired digit
clrf TBLPTRH ;set up table pointer
movff dec1,TBLPTRL
tblrd * ;read the byte
movf TABLAT,W ;get it in W
call rs_send ;transmit it
fixhx2 movlw 0x0f ;mask out high nybble
andwf temp
movlw fhex ;point W to table start
addwf temp ;add offset
movff temp,TBLPTRL
tblrd * ;read the byte
movf TABLAT,W ;get it in W
call rs_send ;transmit it
return