I only suggested driving a mile with a counter to determine number of pulses per mile in the real world.
Whatever you calculated the circumference of your inflated tyre.. it's incorrect on the road.
You can take a GPS to measure distance, inflate rear tyre to pressure, and then ride several miles,
divide the total pulses by the number of miles you rode, and that's your number of pulses per mile,
divide that by five and check that against how many times you think the bolts are going to pass right now.
Going back to your first post, you generally either time the interval between each pulse with an interrupt, and make the calculation each pulse,
or you count the number of pulses over a fixed duration. The first option is faster updating, less annoying when you go to
add to your PBP program... once it's working you can virtually forget about it.
When I went to make a vehicle speedometer the second way, I found the vehicle provided such a low number of pulses per second,
that there was no way for the speedo to tell the difference between say 66 and 67 KmPh.
Say I got 8 pulses a second at 60Kmph, I might have taken 65Kmph to get nine pulses.
So I did the speedo with interrupt, and the PBP program was fast enough to catch every tachometer pulse.
Code:
First of all, I don't want to tie up my processor while a count takes place.
It's only the second method that potentially ties up the chip, and even then,
that depends on how long the pulse is, as to whether or not you have to sit in a loop waiting for pulses.
Bookmarks