418
CHAPTER 18 INTERRUPT FUNCTIONS AND TEST FUNCTIONS
18.4.4 Nesting
Accepting another interrupt request while an interrupt is being serviced is called nesting.
Nesting does not take place unless the interrupts (except the non-maskable interrupt) are enabled to be accepted
(IE = 1). Accepting another interrupt request is disabled (IE = 0) when one interrupt has been accepted. Therefore,
to enable nesting, the EI flag must be set to 1 during interrupt servicing, to enable the another interrupt.
Nesting may not occur even when the interrupts are enabled. This is controlled by the priorities of the interrupts.
Although two types of priorities, default priority and programmable priority, may be assigned to an interrupt, nesting
is controlled by using the programmable priority.
If an interrupt with the same level of priority as or the higher priority than the interrupt currently serviced occurs,
that interrupt can be accepted and nested. If an interrupt with a priority lower than that of the currently serviced interrupt
occurs, that interrupt cannot be accepted and nested.
An interrupt that is not accepted and nested because it is disabled or it has a low priority is kept pending. This
interrupt is accepted after servicing of the current interrupt has been completed and one instruction of the main routine
has been executed.
Nesting is not enabled while the non-maskable interrupt is being serviced.
Table 18-4 shows the interrupts that can be nested, and Figure 18-15 shows an example of nesting.
Table 18-4. Interrupt Requests that Can Be Nested during Interrupt Processing
Maskable Interrupt Request
PR = 0
PR = 1
IE = 1
IE = 0
IE = 1
IE = 0
Non-maskable interrupt processing
×
×
×
×
×
ISP = 0
×
×
×
ISP = 1
×
×
Software interrupt processing
×
×
Remarks 1.
: nesting enabled
2.
×
: nesting disabled
3.
ISP and IE are flags included in PSW.
ISP = 0 : Interrupt with higher priority is processed.
ISP = 1 : Interrupt is not accepted or interrupt with lower priority is processed.
IE
= 0 : Accepting interrupt is disabled
IE
= 1 : Accepting interrupt is enabled
4.
PR is a flag included in PR0L, PR0H.
PR = 0 : Higher priority flag
PR = 1 : Lower priority flag
Non-Maskable
Interrupt Request
Nesting Request
Maskable interrupt
processing
Interrupt
being accepted