ML51/ML54/ML56
Sep. 01, 2020
Page
328
of 719
Rev 2.00
ML
51
/ML
54
/ML
5
6 S
E
RI
E
S
TECHNI
CA
L
RE
F
E
R
E
NC
E
M
A
NU
A
L
ML51/M
L54
/M
L56
Series
Tec
hnical Reference
Manual
Interrupt Priorities
6.2.4.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-5 Interrupt Priority Level Setting
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 pr
iority 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.
Interrupt Priority Control Bits
Interrupt Priority Level
IPH/EIPH0/EIPH1/EIPH2
IP/EIP0/EIP1/EIP2
0
0
Level 0 (lowest)
0
1
Level 1
1
0
Level 2
1
1
Level 3 (highest)
Table 6.2-5 Interrupt Priority Level Setting
This natural priority is defined as shown on Table 6.2-6 Characteristics of Each Interrupt SourceIt also
summarizes the interrupt sources, flag bits, vector addresses, enable bits, priority bits, natural priority
and the permission to wake up the CPU from Power-down mode. For details of waking CPU up from
Power-down mode, please see Section 6.2.2.4 R/W Mode
Interrupt Source
Vector
Address
Interrupt Flag
Enable Bit
Natural
Priority
Priority Control
Bits
PD
Wake-Up
Reset
0000H
-
Always Enabled
Highest -
Yes
CPU Hard Fault
0093H
HFIF (RSR.5)
EHFI (EIE1.3)
1
PHF, PHFH
No
External interrupt 0
0003H
IE0 (TCON.1)
EX0 (I.E.0)
2
PX0, PX0H
Yes
Brown-out
0043H
BOF (BODCON0.3)
EBOD (I.E.5)
3
PBOD, PBODH
Yes
Watchdog Timer
0053H
WDTF (WDCON.5)
EWDT (EIE0.4)
4
PWDT, PWDTH
Yes
Timer 0
000BH
TF0 (TCON.5)
ET0 (I.E.1)
5
PT0, PT0H
No
R/W0 status/time-out
0033H
SI (R/W0CON.3)
I2TOF (R/W0TOC.0)
EI2C0 (EIE0.0)
6
PI2C0, PI2C0H
No