![](http://datasheet.mmic.net.cn/120000/MB90242A_datasheet_3559106/MB90242A_48.png)
2.1 CPU
43
updated to the level of the currently accepted interrupt request, the S flag is set to '1' and CPU process-
ing branches to the interrupt routine.
Accordingly, the next instruction to be executed will be the interrupt processing program defined by the
user.
Figure 2.1.25 shows the flow of interrupt processing from the generation of the hardware interrupt, until
no more interrupt requests remain in the interrupt request program. Figure 2.1.26 shows the flow of
hardware interrupt operations.
Fig. 2.1.25 A Hardware Interrupt from Generation to Exit
(1)
Interrupt factor occurs in internal resource.
(2)
If the interrupt enable bit in that internal resource is set to 'enable,' an interrupt request is gener-
ated and sent from the internal resource to the interrupt controller.
(3)
The interrupt controller receives the interrupt request, determines the priority of simultaneously
received requests, and transfers it to the CPU with the corresponding interrupt level.
(4)
The CPU receives the interrupt from the interrupt controller, and compares its interrupt level
with the value of the IL bit in the processor status (PS) register.
(5)
If the comparison shows a higher priority level than the interrupt level currently being processed,
the CPU then checks the value of the I flag in the same processor status (PS) register.
(6)
If the check in step (5) shows that the I flag is set to 'interrupt enabled' status, the processor waits
for the end of execution of the instruction that is currently being executed, and then sets the ILM
register to the requested level.
(7)
The indicated register settings are saved, and the processor branches, thus transferring control to
the interrupt processing routine.
(8)
Software in the user-defined interrupt processing routine clears the interrupt factor that occurred
in step (1), and then interrupt processing ends.
F
2
M
C
-16
bus
Microcoding
Internal resource
Internal
Le
v
e
lc
o
m
p
ar
at
o
r
In
te
rr
u
p
tl
e
v
e
lIL
Interrupt
PS: Processor status register
I: Interrupt enable flag
ILM: Interrupt level mask register
IR: Instruction register
PS,PC…
PS
I
ILM
F2MC-16 bus
peripheral
circuit
block
controller
…
RAM
IR
Comparator
Check
AND
Enable FF
Factor FF
(7)
(2)
(6)
(5)
(4)
(3)
(1)
(8)