Postby Mark » Tue Feb 06, 2007 7:27 pm
Yes, Ben's approach is neater.
Another variation would be to count clock inputs on Timer 1 input pin and use Timer 0 to interrupt and read Timer 1 and reset it. That way the programme would get a direct count of clock cycles per time interval, correctly selecting Timer 0 may even give a direct reading of cycles per second/64 or similar, which can be easily recalculated to cycles per second.
However, directly clocking in an input ignores issues of debouncing and spikes which are more easily tackled with a polling type method (as above).
Hope this helps,
Mark
Go with the Flow.