Hi, a quick and dirty method: subtract 100's from input until less, and count. Then subtract 10's from input until less, and count. Then take the result. Such way, for a byte variable the worst case is 1+9 cycles. Regards, Imre On Wed, 22 Dec 1999, Edson Brusque wrote: > Hello PICsters! > > I'm needing a fast routine to break-down a byte to three digits: > > before: > input = 137; > > after: > output2 = 7; > output1 = 3; > output0 = 1; > > It doesn't have to be small, but it have to be FAST. > > I'm thinking about doing it with a BIG lookup-table. Anyone have a > better idea? Maybe a hybrid routine (table+calculations). > > Best regards and thanks for all your help, > > Brusque > ___________________________________________________________________________ > | | || |\| | || || |\|\ Edson :-^= Brusque > | | || ||| | || || |||| brusque@flynet.com.br > | |_||_||| |_||_||_|||| Musician, Programmer, Developer, Electronics > | \_\\_\|| \_\\_\\_\||| Blumenau / SC / Brazil / South America > | | | | | | | || Earth / Solar System / Milk Way > |__|__|__|__|__|__|__|| Giro In'Italia homepage: www.flynet.com.br/giro > \__\__\__\__\__\__\__\| C.I.Tronics Lighting Designers: www.citronics.com.br > ---------------------------------------- ICQ# 15937748 --------------------- > Founder of the CUMP mailing list subscribe-cump@egroups.com > Founder of the SoundFont mailing list soundfont-subscribe@onelist.com > ---------------------------------------------------------------------------- > >