Short version: How can I use an external timebase from interrupt 0 instead of the built it timer2?
Long version:
I'd like to use an external timebase for Nicks Mega2560 counter, instead of timer2. (Frequency Counter sketch for Atmega2560) , so instead of using the timer's 1 tick pers seond I'm providing the tick on INT 0
So far I think I know three things :
-
The StartCounting routine need to be modified so it's not using a parameter.
-
Interrupt 0 should be atached to the startcounting routine
ie attachInterrupt(0,StartCounting),RISING) in setup() -
I need to do away with ISR (TIMER2_COMPA_vect) but I'm not sure if the Counter5 releavant code should be part of StartCounting or a separate procedure altogether called from StartCounting.
What am I missing thought process wise?
Any suggestions on how to go about it ?