On Thu, 11 Jun 1998, Clewer,Brian wrote: > James Cameron wrote: > > >Clewer,Brian wrote: > >> My problem is that I have an 8 bit byte and I need to convert it > >> into two printable chars to send to my PC. E.g.. 00111001 would be > >> 39 (in hex). I need to send the two chars 3 and 9 to my PC. > > > > move the byte to W > > swap nibbles (swapf) > > and with 0x0f > > or with 0x30 > > send that byte > > > > move the byte to W again > > and with 0x0f > > or with 0x30 > > send that byte > > > >Hey, I enjoyed that. Uh oh. ;-) > > This is ok if you use the numbers 0 to 9 but it doesn't work if you need > HEX values from A to F. > > Any more ideas? > > Thanks, > Brian. > > Instead of iorlw 30h ; or with 0x30 you should write the following: Version A. call nibble ... nibble: addwf pcl retw '0123456789ABCDEF' .... Version B. addlw 246 skpnc addlw 7 addlw 58 .... now you have it! (all numbers are decimal unless noted otherwise!) Imre