8051 Interrupts
Suresh.P.Nair , HOD - ECE , RCET
1
8051 Microcontroller
Hardware’s view of interrupts
3
Bus
Cascading the 8259 Chip
4
INTA*
General flow
Main
Program
Interrupt
Service
Routine
Process in execution
Process requires I/O service
I/O Interrupt
Returns
CPU Program Organisation
16:
MOV R0, 0x8000
17:
# modifies R0
18:
MOV 0x0001, R0
19:
RETI # ISR return
ISR
100:
101:
instruction
...
Main program
...
Program memory
instruction
Interrupt Service Routine
Main Program
Interrupt
8
External Device
Interrupt Routine
Instruction#1 execution
Instruction#2 execution
Instruction#3 execution
Instruction#4 execution
Instruction#5 execution
RTI
1. INTERRUPT
3. Enter interrupt service routine
2. Complete current
instruction execution
5. Return to main program and resume next instruction
(RTI: Return from Interrupt
6. Complete next
instruction execution
4. Execute interrupt routine
INTERRUPTS
Suresh.P.Nair , HOD - ECE , RCET
9
8051 Microcontroller
Interrupt Vs Polling
Suresh.P.Nair , HOD - ECE , RCET
10
8051 Microcontroller
Interrupt Vs Polling
Suresh.P.Nair , HOD - ECE , RCET
11
8051 Microcontroller
Steps in Executing an Interrupt
Suresh.P.Nair , HOD - ECE , RCET
12
8051 Microcontroller
Six Interrupts in 8051
Six interrupts are allocated as follows:
Suresh.P.Nair , HOD - ECE , RCET
13
8051 Microcontroller
What events can trigger Interrupts?
Suresh.P.Nair , HOD - ECE , RCET
14
8051 Microcontroller
8051 Interrupt Vectors
Suresh.P.Nair , HOD - ECE , RCET
15
8051 Microcontroller
8051 Interrupt related Registers
Suresh.P.Nair , HOD - ECE , RCET
16
8051 Microcontroller
Enabling and Disabling an Interrupt
Suresh.P.Nair , HOD - ECE , RCET
17
8051 Microcontroller
Interrupt Enable (IE) Register
Suresh.P.Nair , HOD - ECE , RCET
18
8051 Microcontroller
MOV IE,#08h�or
SETB ET1
--
Enabling and Disabling an Interrupt
Suresh.P.Nair , HOD - ECE , RCET
19
8051 Microcontroller
Interrupt Priority
Suresh.P.Nair , HOD - ECE , RCET
20
8051 Microcontroller
Interrupt Priority
Suresh.P.Nair , HOD - ECE , RCET
21
8051 Microcontroller
Interrupt Priority (IP) Register
Suresh.P.Nair , HOD - ECE , RCET
22
8051 Microcontroller
PS PT1 PX1 PT0 PX0
Reserved
Serial Port
Timer 1 Pin
INT 1 Pin
Timer 0 Pin
INT 0 Pin
Priority bit=1 assigns high priority
Priority bit=0 assigns low priority