![Nuvoton NuMicro MS51 32K Series Скачать руководство пользователя страница 275](http://html1.mh-extra.com/html/nuvoton/numicro-ms51-32k-series/numicro-ms51-32k-series_technical-reference-manual_1720303275.webp)
MS51
Nov. 28, 2019
Page
275
of 491
Rev 1.00
MS51
32K
SE
RIES
TE
CHNICAL RE
F
EREN
CE MA
N
UAL
the entire port latch value, modify the changed bit, and then write the new value back to the port latch.
6.4.3
Pin Interrupt (PIT)
The MS51 provides pin interrupt input for each I/O pin to detect pin state if button or keypad set is
used. A maximum 8-channel pin interrupt detection can be assigned by I/O port sharing. The pin
interrupt is generated when any key is pressed on a keyboard or keypad, which produces an edge or
level triggering event. Pin interrupt may be used to wake the CPU up from Idle or Power-down mode.
Each channel of pin interrupt can be enabled and polarity controlled independently by PIPEN and
PINEN register. PICON selects which port that the pin interrupt is active. It also defines which type of
pin interrupt is us
– d – level detect or edge detect. Each channel also has its own interrupt flag. There
are total eight pin interrupt flags located in PIF register. The respective flags for each pin interrupt
channel allow the interrupt service routine to poll on which channel on which the interrupt event
occurs. All flags in PIF register are set by hardware and should be cleared by software.
(PIPS7[2:0])
Px.0
Px.1
Px.2
Px.3
P0
P1
P2
P3
Px.4
Px.5
Px.6
Px.7
(PIPS7[6:4])
(PIPS1[2:0])
Px.0
Px.1
Px.2
Px.3
P0
P1
P2
P3
Px.4
Px.5
Px.6
Px.7
(PIPS1[6:4])
(PIPS0[2:0])
Px.0
Px.1
Px.2
Px.3
P0
P1
P2
P3
Px.4
Px.5
Px.6
Px.7
(PIPS0[6:4])
Pin Interrupt
PIF0
PINEN0
PIPEN0
PIT0
PIF1
PINEN1
PIPEN1
PIT1
PIF7
PINEN7
PIPEN7
PIT7
0
1
0
1
0
1
Pin Interrupt Channel 0
Pin Interrupt Channel 1
Pin Interrupt Channel 7
000
001
010
011
000
001
010
011
000
001
010
011
000
111
110
101
100
011
010
001
000
111
110
101
100
011
010
001
000
111
110
101
100
011
010
001
Figure 6.4-5 Pin Interface Block Diagram
Pin interrupt is generally used to detect an edge transient from peripheral devices like keyboard or
keypad. During idle state, the system prefers to enter Power-down mode to minimize power
consumption and waits for event trigger. Pin interrupt can wake up the device from Power-down mode.