Quote:
Originally Posted by Tom Line
Each time your code loops, take the total number of counts from each loop and divide it by the total amount of time between loops.
|
Just a heads-up. The above method has some issues of its own to be aware of:
1) the answer is only as good as the method you use to get (or control) the elapsed time
2) any task swaps or lengthy interrupts which occur between reading the counts and getting the elapsed time will create signal spikes.
3) the faster you run your code, the more RPM jitter you get due to count quantization (for example, at 10ms and 6000 RPM with a 250 counter, the jitter would be ~24 RPM)
4) the slower you run your code, the more phase lag you get in the sensor signal (for example, at 20ms there'd be ~10ms lag)