Nested Interrupts

Question: What's the exact definition of "nested" interrupts and priorities. Under normal circumstances, once an ISR is invoked, no other ISRs can occur until after the RETI instruction, so what exactly does nested interrupts mean?



Interrupts are handled in a normal and standard fashion: they are prioritized, and when the ISR is entered, the global interrupt flag is reset. To nest interrupts, allow recursive interrupts, or to allow a lower priority interrupt to be handled before the present ISR is finished, simply re-enable the global interrupt flag.

Of course, care must be taken to clean up the nested, pending ISRs to avoid filling up and/or corrupting the stack.

Each time an ISR is called the global interrupt flag is disabled, even in the nested interrupt. So to continue to allow nested interrupts, you need to enable the global interrupt flag within each ISR.