![Nuvoton NuMicro MS51 Series Скачать руководство пользователя страница 166](http://html1.mh-extra.com/html/nuvoton/numicro-ms51-series/numicro-ms51-series_technical-reference-manual_1720304166.webp)
MS51
Dec. 17, 2019
Page
166
of 316
Rev 1.01
M
S51
SE
RIES
TE
CHNICA
L REF
ERE
N
CE MA
NU
A
L
The MS51 has a four-priority-level interrupt structure with 30 interrupt sources. Each of the interrupt
sources has an individual priority setting bits, interrupt vector and enable bit. In addition, the interrupts
can be globally enabled or disabled. When an interrupt occurs, the CPU is expected to service the
interrupt. This service is specified as an Interrupt Service Routine (ISR). The ISR resides at a
predetermined address as shown in Table 6.2-1 Interrupt Vectors. When the interrupt occurs if
enabled, the CPU will vector to the respective location depending on interrupt source, execute the
code at this location, stay in an interrupt service state until the ISR is done. Once an ISR has begun, it
can be interrupted only by a higher priority interrupt. The ISR should be terminated by a return from
interrupt instruction RETI. This instruction will force the CPU return to the instruction that would have
been next when the interrupt occurred.
Source
Vector
Addess
Vector
Number
Source
Vector
Address
Vector
Number
Reset
0000H
-
SPI interrupt
004BH
9
External interrupt 0
0003H
0
WDT interrupt
0053H
10
Timer 0 overflow
000BH
1
ADC interrupt
005BH
11
External interrupt 1
0013H
2
Input capture interrupt
0063H
12
Timer 1 overflow
001BH
3
PWM interrupt
006BH
13
Serial port 0 interrupt
0023H
4
Fault Brake interrupt
0073H
14
Timer 2 event
002BH
5
Serial port 1 interrupt
007BH
15
I
2
C status/timer-out interrupt
0033H
6
Timer 3 overflow
0083H
16
Pin interrupt
003BH
7
Self Wake-up Timer interrupt
008BH
17
Brown-out detection interrupt
0043H
8
Table 6.2-1 Interrupt Vectors
6.2.12
Enabling Interrupts
Each of individual interrupt sources can be enabled or disabled through the use of an associated
interrupt enable bit in the IE and EIE0 SFR. There is also a global enable bit EA bit (IE.7), which can
be cleared to disable all the interrupts at once. It is set to enable all individually enabled interrupts.
Setting the EA bit to logic 0 disables all interrupt sources regardless of the individual interrupt-enable
settings. Note that interrupts which occur when the EA bit is set to logic 0 will be held in a pending
state, and will not be serviced until the EA bit is set back to logic 1. All interrupt flags that generate
interrupts can also be set via software. Thereby software initiated interrupts can be generated.
Note that every interrupts, if enabled, is generated by a setting as logic 1 of its interrupt flag no matter
by hardware or software. User should take care of each interrupt flag in its own interrupt service
routine (ISR). Most of interrupt flags should be cleared by writing it as logic 0 via software to avoid
recursive interrupt requests.