piclist 2001\01\19\120246a >
Thread: Maths Problem
face BY : Philip Martin email (remove spam text)

Many thanks to the two Tony's for your replies. Whilst the answers may not
have directly helped solve the problem, they have certainly broadened my
understanding of maths on the PIC. But it was the final comment in Tony
Nixon's post that got me thinking, break the problem down into a manageable

So my train of thought went, if the distance is a fixed value (60 yards),
what would be the speed in MPH if it only took 1 second to travel this
distance. Answer, 122.75 mph. Now all I have to do is divide whatever time I
get into this figure to convert it into MPH. Thus 122.75 / 12.63 seconds
would be 9.718 mph.

Route a)

122.75 = 7A (msb) & 4B (lsb) / 12.63 = 0C (msb) & 3F (lsb) = 00 09 (msb) .
0C 14 (lsb) or 9.3092.

Route b)

12275 = 2F (msb) & F3 (lsb) / 1263 = 04 (msb) & EF (lsb) = 00 09 (msb) . 03
83 (lsb) or 9.908.


Would I be right in thinking that route b) is the more correct way to do it
and the error is due to the maths capability of the math routine?

I have got a routine to convert 16 or 24 bit to BCD and that works fine. But
what I need is a routine to convert BCD to 16 bit, does anyone know the
location of such a routine or, how best to go about this.


Philip Martin.

http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

<NEBBIFJNELKNPDPGLABDIEKLCDAA.philip.martin1@btinternet.com> 7bit

In reply to: <200101191357.OAA18371@mn10.swip.net>
See also: www.piclist.com/techref/microchip/math/index.htm?key=math
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) Maths Problem

month overview.

new search...