Hi Sabachka, The following code converts a 8bit number to 3 digit decimal. The x into y method as I call it is nothing more than subtracting until y begomes negative. dec_8bit clrf digits ;clear any previous data clrf digits+1 clrf digits+2 movf data_in+1,w ;find number of hundreds movwf MA dec_8bit_100s movf MA,w movwf MB ;store data_in+1 - hundreds in MB movlw 100 subwf MA,f btfsc STATUS,C incf digits+2,f ;find number of tens btfsc STATUS,C goto dec_8bit_100s dec_8bit_10s movf MB,w movwf MA ;store data_in+1 -(hundreds + tens) movlw 10 ;find number of tens subwf MB,f btfsc STATUS,C incf digits+1,f btfsc STATUS,C goto dec_8bit_10s movf MA,w ;whatever is left must be numver of ones movwf digits On second thought, if you're displaying in HEX this method is worthless :) Glad I finally contributed to the list :) Steve > On Sat, Aug 16, 2003 at 05:41:08PM -0600, stesquib@MINES.EDU wrote: > > When you go to display the second digit, for example if you want > > to display 0x10, you send 0x10 to your lookup function instead of > > 1! your program jumps over your code and wraps arround! (the PCL > > is incremented 16 instead of 1.) You need to divide the number by > > 16! You could save to a var and rotate right four times ect. I > > That is precisely what was breaking the program, it seems. I am now > using some of your suggestion by using ANDLW 0x0F after a SWAPF for > the digits that will end up on the left half of each pair. > > > think it would be easiest to have a var for each digit and check > > the DC flag for rollovers. Or use the how many times can I suff x > > into y method > > I was pondering this, but realized that it would definately add a lot > of code unless there is a way to define that I am using a 4-bit word > instead of an 8-bit word, as each LED digit only really handles 0-F. > > I'm not sure about the x into y method. I don't really know what it > is. Could you explain it to me, please? > > Thanks, > Sabachka > > -- > sabachka-piclist@oddmagic.net > > The koan is like the pebble in the mouth of a man who walks > in the destert. It does not quench existing thirst, but it > stimulates the means of quenching it. > -- Christmas Humphreys, Buddhism > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.