On an UNO:
What happens if both external interrupts are triggered at the same time?
What happens if an interrupt is triggered when a lower priority interrupt service routine is running?
What happens if an interrupt is triggered when a higher priority interrupt service routing is running?
ArduinoTom:
What happens if both external interrupts are triggered at the same time?
The interrupt with the higher priority runs first.
ArduinoTom:
What happens if an interrupt is triggered when a lower priority interrupt service routine is running?
What happens if an interrupt is triggered when a higher priority interrupt service routing is running?
The second interrupt will be handled after (the reti of) the first, if interrupts stay disabled through the isr.
Interrupts are queued, one after the other. Multiple requests for the same interrupt are lost if not handled in time.
Unless you re-enable interrupts inside an interrupt, any other interrupt will have to wait until control is moved back to normal flow.
As for two interrupts occuring at the same time (within a single cycle) the higher priority interrupt gets called first (from data sheet): The lower the Interrupt Vector address, the higher the priority.
I have a somewhat related question.
Atmega328p datasheet:
There are basically two types of interrupts. The first type is triggered by an event that sets the Interrupt Flag....
...The second type of interrupts will trigger as long as the interrupt condition is present. These interrupts do not necessarily have Interrupt Flags. If the interrupt condition disappears before the interrupt is enabled, the interrupt will not be triggered.
The external interrupts are of type 1. All of the interrupts in the 328p I can think of have interrupt flags and latch an interrupt even if not yet enabled, and hence fall into the first category.
Which interrupts in the 328p are of type 2?
jboyton:
The external interrupts are of type 1.
No, not necessarily, it depends on the configuration.
EDGE triggered interrupts are of type 1, LEVEL triggered are of type 2.
Oh, I see. Thanks.
Atmega328p datasheet:
When an edge or logic change on the INT0 pin triggers an interrupt request, INTF0 becomes set (one)....
....This flag is always cleared when INT0 is configured as a level interrupt.
It's funny, I've never actually used the external interrupts on the 328p. I always end up using the pin change interrupts.
Are there any other type 2 interrupts?