Or how about, instead of repeated subtraction: compare 200 if greater, subtract 200, add 2 to hundreds count compare 100 if greater, subtract 100, add 1 to hundreds count compare 80 if greater, subtract 80, add 8 to tens count compare 40 if greater, subtract 40, add 4 to tens count compare 20 if greater, subtract 20, add 2 to tens count compare 10 if greater, subtract 10, add 1 to tens count same for 'ones' and extending beyond to 16 bits or more. Hefty on code space but fairly rapid. Although I've only tried it on a z8 so I don't know how well it can be done on a Pic. Bill Cornutt wrote: > > If you want a quick program but slow running one, > I have seen where a one byte to bcd conversion > first subtracts 100 from the binary number, > and when it subtracted too much, it adds 100 back into > the binary number. > > Then it subtracts 10 from the binary number until it goes > too far, then add 10 back in to binary number. > > Then does the same for 1. > > This may take 23 subtractions, so it is not fast running. > > Bill C. bill@cornutt.com ---------------------------------------------------------------- Chris Savage chris@cti-vision.demon.co.uk Software Engineer +44 385 396 993 CTIVision Ltd, Egham, UK ----------------------------------------------------------------