Professional Documents
Culture Documents
Interrupt
Structure
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
Lesson 1
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
Outline
• Why are interrupts important?
• Identification of interrupt source
• Mask/ Enable interrupts
• Priority of interrupts
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
Phone ring Importance
Instance of a phone call event is not known.
We can continue our schedule and
attend to phone on an interrupt-event
(ringing).
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
Interrupt Structure Importance
Instance of occurrence of an interrupt event
is not known.
Interrupt handling when event occurs, saves
wait period of the processor for that event.
Processor can execute foreground program
till an interrupt-event starts a service routine.
Enables servicing of multiple sources of
interrupt events.
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
Outline
• Why interrupts important?
• Identification of interrupt source
• Mask/ Enable interrupts
• Priority of interrupts
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
OV flag
Overflow
An MCU set
Input
InCap flag
Timer capture
set
Device Transmitted a
character Tx flag set
Serial
Device Received - a Rx flag
character set
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
Interrupt Source Event Identification
by flag bit
Each interrupt source of each device can
be assigned a flag. Flag(s) shows the
device status
A flag is reset at the start.
A device event sets the flag.
The flag, when sets, shows the need to
service the interrupt (need of executing
the service routine associated with that
interrupt occurrence).
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
Interrupt Source Event Service Need
Identification by pending Bit
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
MCU
Non
Maskable
interrupts
Maskable
interrupts
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
Examples- Maskable Interrupt Sources
Timer overflow
Serial Transmitter buffer empty
Serial Receiver buffer full
Serial Receiver FIFO half full
ADC conversion over
Real time clock ticks
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
Examples- Nonmaskable Interrupt
Sources
Illegal opcode
Software interrupt
RAM parity check error
Clock failure
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
Software can mask servicing of the
Maskable interrupt event so that the
current routine continues when mask
bit set or enable bit reset
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
Primary level mask
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
Secondary level Mask
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
• Primary mask bit disables services
of all maskable interrupts
• Secondary mask bit disables
service for an individual maskable
interrupt event
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
8051/52 Interrupt Enable Register
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
1 Primary mask bit EA Enable All
0 Disable T2 ET2 Enable T2
1 Enable SI ES Enable SI
1 Enable T1 ET1 Enable T1
0 Disable INT1 EX1 Enable INT1
0 Disable T0 ET0 Enable T0
0 DisableINT0 EX0 Enable INT0
Interrupt Enable when a bit
enable/disable bits sets and when EA =1
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
Event(s) Identify
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
An MCU Interrupt
event
MCU Assigned
Internal Priority
User Assigned new
priority
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
MCU Internally Assigned Priorities
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
8051 Interrupts Defaults Priorities
High
INT0 INT0 pin interrupt
T0 T0OVF interrupt
INT1 INT0 pin interrupt
T1 T1OVF interrupt
RI and TI RI and then Tx
T2 complete
T2EX pin-ve edge
SI Synch capture/reload interrupt
mode Synchronous Serial Device mode
interrupt
Low Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
User Assigned Priorities
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
I interrupt Priority Register
8051 P
IP.7 IP.6 IP.7 IP.6 IP.7 IP.6 IP.7 IP.6
- - PT2 PS PT1 PX1 PT0 PX0
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
Assigning Serial Device and INT1 interrupts
Higher priority for service
=0 Low PT2 Priority T2
1 High PS Priority SI
0 Low PT1 Priority T1
1 High PX1 Priority INT1
0 Low PT0 Priority T0
0 Low PX0 Priority INT0
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
Summary
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
• Interrupts from Devices and events
are important
• Flag identifies an interrupt
• Primary mask bits disables services of
all maskable interrupts
• Secondary mask bit disables service
for an individual maskable interrupt
event
• Hardware assigns default priorities
• Software priority override a hardware
priority
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
End of Lesson 1
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005
THANK YOU
Ch05L1-"Microcontrollers....", Raj
Kamal, from Pearson Education,
2005