![](http://datasheet.mmic.net.cn/330000/MB90F562_datasheet_16437954/MB90F562_163.png)
6.4
6.4.3 Procedure for using hardware interrupts
Hardware Interrupts
MB90560 series
CHAPTER 6 INTERRUPTS
139
Before hardware interrupts can be used, the system stack area, peripheral function,
and interrupt control register (ICR) must be set.
I
Procedure for using hardware interrupts
Figure 6.4-4 shows an example of the procedure for using hardware interrupts.
Figure 6.4-4 Procedure for using hardware interrupts
Set the system stack area.
Initialize a peripheral function that can generate interrupt requests.
Set the interrupt control register (ICR) in the interrupt controller.
Set the peripheral function to the operation start status, and set the interrupt enable bit to
enable.
Set the interrupt level mask register (ILM) and interrupt enable flag (I) to interrupt
acceptable.
An interrupt generated in the peripheral function causes a hardware interrupt request.
The interrupt processing hardware saves the registers and branches to the interrupt
processing program.
The interrupt processing program processes the peripheral function in response to the
generated interrupt.
Clear the peripheral function interrupt request.
(10) Execute the interrupt return instruction, and return to the program location before branching.
(1)
(2)
(3
(4)
(5)
(6)
(7)
(8)
(9)
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)
(10)
Start
Set operation start for the
peripheral function. Set the
interrupt enable bit to enable
Set the ICR in the interrupt
controller
Initialize the peripheral function
Set the system stack area
Set the ILM and I in the PS
Main program
Interrupt request
generated
Hardware
processing
Main program
Stack processing branches to
the interrupt vector
Processing for interrupt to the
peripheral function (execute the
interrupt processing routine)
Interrupt processing program
Clear the interrupt cause
Interrupt return instruction
(RETI)