Thanks for that, I didn't think of re-arranging it that way. Actually, I can probably make the constant 256 which means that I could put B in the high byte and then divide by A. The error would be acceptable for the intended usage. So all I really need is a 16 bit / 8 bit divide routine then? That will give me a 16 bit result for my counter won't it? Graham wrote: >For best resolution, you need to do a 16 bit multiply (B * 255) and then >divide by A. > > > I need to implement the following equation in a 16F876. > > > RESULT = (255 / A) * B > > > A and B are bytes (each have possible values of 01 to FF) > > > RESULT is a word (unsigned) for a timer routine counter. > > > Speed is not an issue. Code space is not really either. > > > What's the best way to do this sort of thing? > > > Regards... -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu