I am using the input capture on a ATMEGA644p to measure the pulse width of an encoder signal.
The problem occurs in this sequence of events:
1) The program disables interrupts
2) A timer overflow occurs
3) An capture event occurs
In this scenario the input capture interrupt has priority over the timer overflow interrupt and will be serviced before the timer overflow interrupt. This creates a problem for me because when I update the motor speed in the input capture interrupt I need to know how many times the counter has overflowed.
If only I could swap the vector priorities this wouldn't happen.
Has anyone else run into this issue?