I'm currently counting the rising edges on pin TX0/PD3 (this is on the Atmega32U4, I think I would use pin D2 on the uno). I currently attachInterrupt(3, fn, RISING); and the function fn simply ++ a volatile unsigned long.
I think this is not a precise wat to count, is it possible I am missing a few rising edges, for example if this interrupt would happen while another interrupt is going on ? I'm also using ISR(TIMER1_CAPT_vect) for some other purpose, maybe interfering ? Also, for example, when I open the Arduino Serial Monitor, it seems I have a few edges not being detected, is it because the CPU is busy with something, and not running my interrupt ? Or maybe I should not use TXO pin for that purpose ? This is not the same TXO as the USB serial communication on the 32U4, right ?
Is it possible to set the timers (TCNT1, TCCR2 and other mysterious registers) to actually count for me ? And I can simply query the current sum at any time ?