Olin Lathrop wrote:
{Quote hidden}>
> > > X / 370 = 4000
> > > X = 4000 * 370 = 1,480,000 = 169540h
> > >
> > > >From the hex value of X you can see that a minimum of 21 bits are
> required
> > > for X. That means you can use a 24 or 32 bit integer divide routine.
> >
> >
> > Thanks again Olin, that all makes perfect sense. Now
> > I have the rouble of getting enough resolution at the
> > other end of the range. My big period is 10kph=200,000
> > so I would be doing:
> > (10kph) 1,480,000 / 200,000 = 7.4
> > (11kph) 1,480,000 / 182,000 = 8.1
> > (12kph) 1,480,000 / 167,000 = 8.9
> >
> > Obviously with rounding this shoots my resolution
> > out the window. I need better than 0.25kph and
> > prefer 0.1kph throughout the whole range.
>
> Something seems inconsistant here. If a period of 370 implies 400Km/H, then
> 10Km/H would be 14,800, not 200,000. Your 200,000 figure must be for a
> different bike configuration, in which case you would be using a different X
> (20,000,000 in that case). Once X has been chosen for the particular bike
> configuration so that you get 4000 for 400Km/H, you end up with a value
> that can resolve .1Km/H.
>
> By the way, given your potentially large X values, you need to be doing a
> 32, not 24 bit, divide. As you mentioned in your other post, you have
> 16,000 cycles available, which is way more than enough.
Thanks Olin, the inconsistency is indeed my problem.
I really wanted to avoid having to configure the
logger for different bikes. The logger will be used
at riding training schools, and will be plugged in
a number of different bikes.
The perfect setup is simply to have enough resolution
for the whole 10Hz to 5400Hz range.
I'm still stumped. The last two days I've been working
on the hardware. It's looking more like going to 20bit
speed data storage, and just storing the period as is.
This has to give the best possible accuracy with the
data at hand but will cost one more eeprom chip.
-Roman
--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads