:idea:
Hello, if you use timer 1 to generate your timed intereupt, say every 100MS, you can then decrease a reg in the int sub, start at 5, until 0, this will give you your 1/2 sec timer.
Use tmr0 to count the pulses on the pin (tach in) when tmr1 times out (after 500ms) move tmr0 value into "pulse_cnt" reg, re-clear tmr0, reset tmr1 counter (to 5) and your "pulse_cnt" reg will be updated every 500ms automatically.
I did a rev counter many moons ago, I think I timed the period between each pulse, and worked out the rpm from that time period. Just another way to do it, this gives faster results than waiting 1/2 sec for rpm's
You will probably want to add the result you get from "pulse_cnt" to "av_cnt" and divide this by 2, this will average out the pulses counted.
For example if the pulse count is "almost" 3, you will get 2 on 1 count and 3 and another......etc....
Hope this helps!