If an AVR's 8-bit timer compare register is 255 and the timer overflows (according to the datasheet, the compare interrupt happens on the next timer clock cycle) then both the overflow interrupt and the compare interrupt should be due at the same time. Which will be serviced first?
Electronic – On an AVR (ATtiny2313), which is serviced first when TIMER0_OVF and TIMER0_COMPA are due at the same time
avrtimer
Related Topic
- Electronic – How to configure the internal oscillator in a PIC16F616
- Electronic – Use AVR Timer1 for Compare Interrupt AND PWM at same time
- Electronic – Race condition in AVR timers
- Electronic – Simple AVR LED blink in assembly – why does this code not work
- Electronic – Timer/counter overflow and TIFR register
- Electrical – The usefulness of some bits in TIMSK register
Best Answer
See the datasheet for the ATtiny2313: http://www.atmel.com/dyn/resources/prod_documents/doc2543.PDF
The priority of interrupts is determined by the order of the interrupt vectors. See page 46 for the list. The lower the number, the higher the priority. Since Timer/Counter0 Overflow has a lower number (7) than Timer/Counter0 Compare Match A (14), the overflow ISR will run first.