Henrik, You have to convert the 32 bit binary number to a decimal form and then convert the decimal form to ascii by adding 30h to each decimal digit. I will run through the example for an 8 bit binary conversion just to show you the principles involved. Using pseudo-code: bin_to_dec: ;assume that upon entry 8 bit number is in bin_holder. ;assume that decimal result will be placed in dec3, dec2, dec1 ;where dec3 is most significant decimal digit. ;uses temp holder . ;upon exit bin_holder will be trashed. CLEAR dec1 ;clear all decimal holders to zero. CLEAR dec2 CLEAR dec3 ROTATE bin_holder RIGHT INTO CARRY ;bit0 <1> handled first... IF CARRY=1 SET decnum=1 CALL ADD_ONES ENDIF ROTATE bin_holder RIGHT INTO CARRY ;bit1 <2> handled next... IF CARRY=1 SET decnum=2 CALL ADD_ONES ENDIF ROTATE bin_holder RIGHT INTO CARRY ;bit2 <4> handled next... IF CARRY=1 SET decnum=4 CALL ADD_ONES ENDIF ROTATE bin_holder RIGHT INTO CARRY ;bit3 <8> handled next... IF CARRY=1 SET decnum=8 CALL ADD_ONES ENDIF ROTATE bin_holder RIGHT INTO CARRY ;bit4 <16> handled next... IF CARRY=1 SET decnum=1 CALL ADD_TENS SET decnum=6 CALL ADD_ONES ENDIF ROTATE bin_holder RIGHT INTO CARRY ;bit5 <32> handled next... IF CARRY=1 SET decnum=3 CALL ADD_TENS SET decnum=2 CALL ADD_ONES ENDIF ROTATE bin_holder RIGHT INTO CARRY ;bit6 <64> IF CARRY=1 SET decnum=6 CALL ADD_TENS SET decnum=4 CALL ADD_ONES ENDIF ROTATE bin_holder RIGHT INTO CARRY ;bit7 <128> IF CARRY=1 SET decnum=1 CALL ADD_HUNDREDS SET decnum=2 CALL ADD_TENS SET decnum=8 CALL ADD_ONES ENDIF RETURN ADD_ONES: ADD decnum to dec1 IF dec1 > 9 SUBTRACT 10d from dec1 GOTO ADD_TENS ENDIF RETURN ADD_TENS: ADD decnum to dec2 IF dec2 > 9 SUBTRACT 10d from dec2 GOTO ADD_HUNDREDS ENDIF RETURN ADD_HUNDREDS: ADD decnum to dec3 IF dec3 > 9 SUBTRACT 10d from dec3 GOTO ADD_TENS ENDIF RETURN *** END OF PROGRAM *** There are many ways to improve upon this code, but this code fragment should give you an idea of what the basic algorithm is like. For a full 32 bit implementation you would need ADD routines for thousands, tens_thousands, hundreds_thousands, millions, all the way up to thousand_millions (billions to some of us). That means 32 code segments to handle the 32 bits, and 10 decimal ADD routines. Note that any decimal carry required is handled by the GOTOs. This method is easy to understand, but in reality it would be more efficient to implement the decimal additions using indirect addressing via the FSR. That cuts the code SIZE down a lot. Note that the decimal ADD routines can also be used by other parts of your program Fr. Tom McGahee ----- Original Message ----- From: Henrik Holmgerd To: Sent: Thursday, June 08, 2000 7:22 AM Subject: [PIC]: 32bit binary to ASCII conversion Hi all I have a project where I have to convert a 32 bit binary or hex number to ASCII to be displayed on a LCD. Does some one on this list have done this before, if so are you willing to share the solution with me or give me some hints. I have done decimal to ASCII conversion no problem, but now my project end up with a 32 bit number and then I have only very complicated solutions. tnx in advance. \||||||/ _____oo0o__( o o )__o0oo_____ (_) Henrik Holmgerd