piclist 2001\09\19\092331a >
Thread: Scale a 16 bit number to 3 decimal digits
face BY : mikespamBeGone@STOPspamwhitewing.co.uk

On Tue, 18 Sep 2001 18:08:40 -0600, you wrote:

>Good day to all.
>Has anyone run across a routine to scale a 16 bit number to 3 decimal
>digits (0-999).  I'm sure that I saw this a couple of years ago but can't
>find it in my snippets file or on piclist.com.
>Any thoughts?
Do a 16x16 Multiply by 1000 and use the top byte as the result. Use
1000 rather than 999 to get closer rounding.
If code is tight and accuracy not too important, if you can multiply
by 1024 instead this will use less code - just limit the number to
63936 and shift it down 6 places.

http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads

<o5qgqt04gikn0j934a1jdbjsfhh3nu8d14@4ax.com> quoted-printable

In reply to: <>
See also: www.piclist.com/techref/microchip/devices.htm?key=pic
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) Scale a 16 bit number to 3 decimal digits

month overview.

new search...