MS51
Nov. 28, 2019 Page 235 of 491 Rev 1.00
MS51 32K SERIES TECHNICAL REFERENCE MANUAL
Interrupt Priorities 6.2.6.3
There are four priority levels for all interrupts. They are level highest, high, low, and lowest; and they
are represented by level 3, level 2, level 1, and level 0. The interrupt sources can be individually set to
one of four priority levels by setting their own priority bits. Table 6.2-4 lists four priority setting.
Naturally, a low level priority interrupt can itself be interrupted by a high level priority interrupt, but not
by any same level interrupt or lower level. In addition, there exists a pre-defined natural priority among
the interrupts themselves. The natural priority comes into play when the interrupt controller has to
resolve simultaneous requests having the same priority level.
In case of multiple interrupts, the following rules apply:
1. While a low priority interrupt handler is running, if a high priority interrupt arrives, the handler
will be interrupted and the high priority handler will run. When the high priority handler does
“RETI”, the low priority handler will resume. When this handler does “RETI”, control is passed
back to the main program.
2. If a high priority interrupt is running, it cannot be interrupted by any other source – even if it is
a high priority interrupt which is higher in natural priority.
3. A low-priority interrupt handler will be invoked only if no other interrupt is already executing.
Again, the low priority interrupt cannot preempt another low priority interrupt, even if the later
one is higher in natural priority.
4. If two interrupts occur at the same time, the interrupt with higher priority will execute first. If
both interrupts are of the same priority, the interrupt which is higher in natural priority will be
executed first. This is the only context in which the natural priority matters.
This natural priority is defined as shown on Table 6.2-4 Interrupt Priority Level Setting