Which processor? If it has a 8x8 hardware multiplier there might be some options using it. I'd have to spend some time figuring out how to leverage it since it only multiplies. Often you can get around this by a multiply by a constant and a shift. The constant is chosen such that the result is an even power of two too high, which results in your division result being in the most significant bits, and a fractional remainder being in the least significant bits. On Fri, May 18, 2018, 4:00 PM Dwayne Reid wrote: > Good day to all. > > I'm looking for a small, fast 9-bit binary-to-decimal conversion > routine. Somewhere between Scott Datallo's 8-bit-to-decimal and John > Payson's 16-bit-to-decimal routines. > > Input range is [0..511] in binary, output in BCD or > packed-BCD. Actual input range for this project is 0..399 but I > might as well try to get the full 9-bits of range. > > Short and fast if possible. > > I've been looking at PICLIST.com as well as my old email archives but > haven't seen anything that is both short and fast. > > Does anyone have something that they can share? > > Many thanks! > > dwayne > > -- > Dwayne Reid > Trinity Electronics Systems Ltd Edmonton, AB, CANADA > 780-489-3199 voice 780-487-6397 fax 888-489-3199 Toll Free > www.trinity-electronics.com > Custom Electronics Design and Manufacturing > > -- > http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .