deveopmen
Interrupts
Preliminary Specifications REV.B
Specifications in this manual are tentative and subject to change.
Mitsubishi microcomputers
M16C/80 (144-pin version) group
SINGLE-CHIP 16-BIT CMOS MICROCOMPUTER
67
Interrupt Priority
If two or more interrupt requests are sampled active at the same time, whichever interrupt request is
acknowledged that has the highest priority.
Maskable interrupts (Peripheral I/O interrupts) can be assigned any desired priority by setting the inter-
rupt priority level select bit accordingly. If some maskable interrupts are assigned the same priority level,
the interrupt that a request came to most in the first place is accepted at first, and then, the priority
between these interrupts is resolved by the priority that is set in hardware.
Certain nonmaskable interrupts such as a reset (reset is given the highest priority) and watchdog timer
interrupt have their priority levels set in hardware. Figure 1.9.7 lists the hardware priority levels of these
interrupts.
Software interrupts are not subjected to interrupt priority. They always cause control to branch to an
interrupt routine whenever the relevant instruction is executed.
Interrupt Resolution Circuit
Interrupt resolution circuit selects the highest priority interrupt when two or more interrupt requests are
sampled active at the same time.
Figure 1.9.8 shows the interrupt resolution circuit.
Reset > NMI > Watchdog > Peripheral I/O > Single step > Address match
Return from Interrupt Routine
As you execute the REIT instruction at the end of the interrupt routine, the contents of the flag register
(FLG) and program counter (PC) that have been saved to the stack area immediately preceding the
interrupt sequence are automatically restored. In high-speed interrupt, as you execute the FREIT instruc-
tion at the end of the interrupt routine, the contents of the flag register (FLG) and program counter (PC)
that have been saved to the save registers immediately preceding the interrupt sequence are automati-
cally restored.
Then control returns to the routine that was under execution before the interrupt request was acknowl-
edged, and processing is resumed from where control left off.
If there are any registers you saved via software in the interrupt routine, be sure to restore them using an
instruction (e.g., POPM instruction) before executing the REIT or FREIT instruction.
When switching the register bank before executing REIT and FREIT instruction, switched to the register
bank immediately before the interrupt sequence.
Figure 1.9.7. Interrupt priority that is set in hardware