SlideShare a Scribd company logo
Microcontroller 8051
Interrupts
Present by:
LAXMI INSTITUTION OF
TECHNOLOGY
Sr. no. Name Enrollment No.
1 Kulkarni Ajay 150863109004
2 Nakum Dharmesh M. 150863109005
3 Nayakvade Ragini B. 150863109006
4 Parmar Ashish V. 150863109007
Sub: MMCI
2150907
Interrupts Programming
 An interrupt is an external or internal event that interrupts the
microcontroller to inform it that a device needs its service.
Interrupts vs. Polling
 A single microcontroller can serve several devices.
 There are two ways to do that:
◦ interrupts
◦ polling.
 The program which is associated with the interrupt is called
the interrupt service routine (ISR) or interrupt handler.
Interrupts vs. Polling
 An interrupt is an external or internal event that
interrupts the microcontroller
◦ To inform it that a device needs its service
 A single microcontroller can serve several devices by
two ways
◦ Interrupts
 Whenever any device needs its service, the device notifies the
microcontroller by sending it an interrupt signal
 Upon receiving an interrupt signal, the microcontroller
interrupts whatever it is doing and serves the device
Interrupts vs. Polling (cont.)
◦ The program which is associated with the interrupt is
called the interrupt service routine (ISR) or interrupt
handler
◦ Polling
 The microcontroller continuously monitors the
status of a given device
◦ ex. JNB TF, target
 When the conditions met, it performs the service
 After that, it moves on to monitor the next device
until every one is serviced
◦ Polling can monitor the status of several devices and
serve each of them as certain conditions are met
 The polling method is not efficient, since it wastes
much of the microcontroller’s time by polling
devices that do not need service
Interrupts vs. Polling (cont.)
 The advantage of interrupts is:
◦ The microcontroller can serve many devices (not all at
the same time)
 Each device can get the attention of the microcontroller
based on the assigned priority
 For the polling method, it is not possible to assign
priority since it checks all devices in a round-robin
fashion
◦ The microcontroller can also ignore (mask) a device
request for service
 This is not possible for the polling method
Steps in executing an interrupt
 Finish current instruction and saves the PC on stack.
 Jumps to a fixed location in memory depend on type of
interrupt
 Starts to execute the interrupt service routine until RETI
(return from interrupt)
 Upon executing the RETI the microcontroller returns to the
place where it was interrupted. Get pop PC from stack
Interrupt Sources
 Original 8051 has 6 sources of
interrupts
◦ Reset
◦ Timer 0 overflow
◦ Timer 1 overflow
◦ External Interrupt 0
◦ External Interrupt 1
◦ Serial Port events (buffer full, buffer empty, etc)
 Enhanced version has 22 sources
◦ More timers, programmable counter array, ADC, more
external interrupts, another serial port (UART)
Interrupt Vectors
Each interrupt has a specific place in code memory
where program execution (interrupt service routine)
begins.
External Interrupt 0: 0003h
Timer 0 overflow: 000Bh
External Interrupt 1: 0013h
Timer 1 overflow: 001Bh
Serial : 0023h
Timer 2 overflow(8052+) 002bh
Note: that there are
only 8 memory
locations between
vectors.
SJMP main
ORG 03H
ljmp int0sr
ORG 0BH
ljmp t0sr
ORG 13H
ljmp int1sr
ORG 1BH
ljmp t1sr
ORG 23H
ljmp serialsr
ORG 30H
main:
…
END
ISRs and Main Program in
8051
Interrupt Enable (IE) register
All interrupt are disabled after reset
We can enable and disable them bye IE
Enabling and disabling an
interrupt
by bit operation
Recommended in the middle of program
SETB EA ;Enable All
SETB ET0 ;Enable Timer0 ovrf
SETB ET1 ;Enable Timer1 ovrf
SETB EX0 ;Enable INT0
SETB EX1 ;Enable INT1
SETB ES ;Enable Serial port
by mov instruction
Recommended in the first of program
MOV IE, #10010110B
SETB IE.7
SETB IE.1
SETB IE.3
SETB IE.0
SETB IE.2
SETB IE.4
Timer ISR
 Notice that
◦ There is no need for a “CLR TFx” instruction in
timer ISR
◦ 8051 clears the TF internally upon jumping to
ISR
 Notice that
◦ We must reload timer in mode 1
◦ There is no need on mode 2 (timer auto
reload)
External interrupt type control
 By low nibble of Timer control register TCON
 IE0 (IE1): External interrupt 0(1) edge flag.
◦ set by CPU when external interrupt edge (H-to-L) is detected.
◦ Does not affected by H-to-L while ISR is executed(no int on int)
◦ Cleared by CPU when RETI executed.
◦ does not latch low-level triggered interrupt
 IT0 (IT1): interrupt 0 (1) type control bit.
◦ Set/cleared by software
◦ IT=1 edge trigger
◦ IT=0 low-level trigger
TF1 TR1 TF0 TR0 IE1 IT1 IE0 IT0
Timer 1 Timer0 for Interrupt
(MSB) (LSB)
External Interrupts
IE0 (TCON.3)
0003
INT0
(Pin 3.2) 0
1
2
IT0
Edge-triggered
Level-triggered (default)
IE1 (TCON.3)
INT0
(Pin 3.3) 0
1
2
IT1
Edge-triggered
Level-triggered (default)
0013
Interrupt Priorities
 What if two interrupt sources interrupt at the same
time?
 The interrupt with the highest PRIORITY gets
serviced first.
 All interrupts have a power on default priority order.
1. External interrupt 0 (INT0)
2. Timer interrupt0 (TF0)
3. External interrupt 1 (INT1)
4. Timer interrupt1 (TF1)
5. Serial communication (RI+TI)
 Priority can also be set to “high” or “low” by IP reg.
Interrupt Priorities (IP) Register
IP.7: reserved
IP.6: reserved
IP.5: timer 2 interrupt priority bit(8052 only)
IP.4: serial port interrupt priority bit
IP.3: timer 1 interrupt priority bit
IP.2: external interrupt 1 priority bit
IP.1: timer 0 interrupt priority bit
IP.0: external interrupt 0 priority bit
--- PX0PT0PX1PT1PSPT2---
Interrupt Priorities Example
 MOV IP , #00000100B or SETB IP.2 gives priority order
1. Int1
2. Int0
3. Timer0
4. Timer1
5. Serial
 MOV IP , #00001100B gives priority order
1. Int1
2. Timer1
3. Int0
4. Timer0
5. Serial
--- PX0PT0PX1PT1PSPT2---
Interrupt inside an interrupt
--- PX0PT0PX1PT1PSPT2---
 A high-priority interrupt can interrupt a low-priority interrupy
 All interrupt are latched internally
 Low-priority interrupt wait until 8051 has finished servicing the
high-priority interrupt
The End

More Related Content

What's hot

Interrupts for PIC18
Interrupts for PIC18Interrupts for PIC18
Interrupts for PIC18
raosandy11
 
8051 Inturrpt
8051 Inturrpt8051 Inturrpt
8051 Inturrpt
Ramasubbu .P
 
Memory & I/O interfacing
Memory & I/O  interfacingMemory & I/O  interfacing
Memory & I/O interfacing
deval patel
 
8051 Assembly Language Programming
8051 Assembly Language Programming8051 Assembly Language Programming
8051 Assembly Language Programming
Ravikumar Tiwari
 
Timer programming for 8051 using embedded c
Timer programming for 8051 using embedded cTimer programming for 8051 using embedded c
Timer programming for 8051 using embedded c
Vikas Dongre
 
INTERRUPTS OF 8086 MICROPROCESSOR
INTERRUPTS OF 8086 MICROPROCESSORINTERRUPTS OF 8086 MICROPROCESSOR
INTERRUPTS OF 8086 MICROPROCESSOR
Gurudev joshi
 
8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil Kaware8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil KawareProf. Swapnil V. Kaware
 
8085 Architecture & Memory Interfacing1
8085 Architecture & Memory Interfacing18085 Architecture & Memory Interfacing1
8085 Architecture & Memory Interfacing1
techbed
 
8051 data types and directives
8051 data types and directives8051 data types and directives
8051 data types and directives
SARITHA REDDY
 
I/O port programming in 8051
I/O port programming in 8051I/O port programming in 8051
I/O port programming in 8051
ssuser3a47cb
 
8051 programming in c
8051 programming in c8051 programming in c
8051 programming in c
Dr. Ritula Thakur
 
Microprocessor 8086
Microprocessor 8086Microprocessor 8086
Microprocessor 8086
Gopikrishna Madanan
 
Programming 8051 Timers
Programming 8051 Timers Programming 8051 Timers
Programming 8051 Timers ViVek Patel
 
8257 DMA Controller
8257 DMA Controller8257 DMA Controller
8257 DMA Controller
ShivamSood22
 
8051 Timers / Counters
8051 Timers / Counters8051 Timers / Counters
8051 Timers / CountersPatricio Lima
 
Interfacing Stepper motor with 8051
Interfacing Stepper motor with 8051Interfacing Stepper motor with 8051
Interfacing Stepper motor with 8051
Pantech ProLabs India Pvt Ltd
 
8051 timer counter
8051 timer counter8051 timer counter
8051 timer counterankit3991
 
8085 addressing modes
8085 addressing modes8085 addressing modes
8085 addressing modes
Vijay Kumar
 
Stack in 8085 microprocessor
Stack in 8085 microprocessorStack in 8085 microprocessor
Stack in 8085 microprocessor
hepzijustin
 

What's hot (20)

Interrupts for PIC18
Interrupts for PIC18Interrupts for PIC18
Interrupts for PIC18
 
8051 Inturrpt
8051 Inturrpt8051 Inturrpt
8051 Inturrpt
 
Memory & I/O interfacing
Memory & I/O  interfacingMemory & I/O  interfacing
Memory & I/O interfacing
 
8051 Assembly Language Programming
8051 Assembly Language Programming8051 Assembly Language Programming
8051 Assembly Language Programming
 
Timer programming for 8051 using embedded c
Timer programming for 8051 using embedded cTimer programming for 8051 using embedded c
Timer programming for 8051 using embedded c
 
INTERRUPTS OF 8086 MICROPROCESSOR
INTERRUPTS OF 8086 MICROPROCESSORINTERRUPTS OF 8086 MICROPROCESSOR
INTERRUPTS OF 8086 MICROPROCESSOR
 
8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil Kaware8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil Kaware
 
8051 interrupts
8051 interrupts8051 interrupts
8051 interrupts
 
8085 Architecture & Memory Interfacing1
8085 Architecture & Memory Interfacing18085 Architecture & Memory Interfacing1
8085 Architecture & Memory Interfacing1
 
8051 data types and directives
8051 data types and directives8051 data types and directives
8051 data types and directives
 
I/O port programming in 8051
I/O port programming in 8051I/O port programming in 8051
I/O port programming in 8051
 
8051 programming in c
8051 programming in c8051 programming in c
8051 programming in c
 
Microprocessor 8086
Microprocessor 8086Microprocessor 8086
Microprocessor 8086
 
Programming 8051 Timers
Programming 8051 Timers Programming 8051 Timers
Programming 8051 Timers
 
8257 DMA Controller
8257 DMA Controller8257 DMA Controller
8257 DMA Controller
 
8051 Timers / Counters
8051 Timers / Counters8051 Timers / Counters
8051 Timers / Counters
 
Interfacing Stepper motor with 8051
Interfacing Stepper motor with 8051Interfacing Stepper motor with 8051
Interfacing Stepper motor with 8051
 
8051 timer counter
8051 timer counter8051 timer counter
8051 timer counter
 
8085 addressing modes
8085 addressing modes8085 addressing modes
8085 addressing modes
 
Stack in 8085 microprocessor
Stack in 8085 microprocessorStack in 8085 microprocessor
Stack in 8085 microprocessor
 

Similar to Micro controller 8051 Interrupts

Interrupts programming in embedded C using 8051
Interrupts programming in embedded C using 8051Interrupts programming in embedded C using 8051
Interrupts programming in embedded C using 8051
Vikas Dongre
 
Embedded systems, lesson 16
Embedded systems, lesson 16Embedded systems, lesson 16
Embedded systems, lesson 16
REKHASENCHAgs0801bm1
 
Mc module5 ppt_msj
Mc module5 ppt_msjMc module5 ppt_msj
Mc module5 ppt_msj
mangala jolad
 
DPA
DPADPA
Interrupt programming
Interrupt programming Interrupt programming
Interrupt programming vijaydeepakg
 
unit 3 a.pptxppppppppppppppppppppppppppp
unit 3 a.pptxpppppppppppppppppppppppppppunit 3 a.pptxppppppppppppppppppppppppppp
unit 3 a.pptxppppppppppppppppppppppppppp
sachin397946
 
Interrupt in 8051
Interrupt in 8051Interrupt in 8051
Interrupt in 8051
ssuser3a47cb
 
Unit 3 timer and counter and there application .pptx
Unit 3 timer and counter and there application .pptxUnit 3 timer and counter and there application .pptx
Unit 3 timer and counter and there application .pptx
naveen088888
 
Interrupt in ATMEGA328P.pptx
Interrupt in ATMEGA328P.pptxInterrupt in ATMEGA328P.pptx
Interrupt in ATMEGA328P.pptx
SujalKumar73
 
Interrupt.pptx
Interrupt.pptxInterrupt.pptx
Interrupt.pptx
PallaviHailkar
 
Interrupts on 8086 microprocessor by vijay kumar.k
Interrupts on 8086 microprocessor by vijay kumar.kInterrupts on 8086 microprocessor by vijay kumar.k
Interrupts on 8086 microprocessor by vijay kumar.k
Vijay Kumar
 
8 interrupt 8051
8 interrupt 80518 interrupt 8051
8 interrupt 8051
daniemol
 
37471656 interrupts
37471656 interrupts37471656 interrupts
37471656 interrupts
tt_aljobory
 
Unit 5_interrupt programming_Part 1
Unit 5_interrupt programming_Part 1Unit 5_interrupt programming_Part 1
Unit 5_interrupt programming_Part 1
KanchanPatil34
 
Microcontroller part 2
Microcontroller part 2Microcontroller part 2
Microcontroller part 2
Keroles karam khalil
 
Timing n interrupt.pptx
Timing n interrupt.pptxTiming n interrupt.pptx
Timing n interrupt.pptx
JasaRChoudhary
 
8051 Microcontroller Overview by Venkatrao Ramisetti
8051 Microcontroller Overview by Venkatrao Ramisetti 8051 Microcontroller Overview by Venkatrao Ramisetti
8051 Microcontroller Overview by Venkatrao Ramisetti
VenkatraoRamisetti
 
Interrupts.ppt
Interrupts.pptInterrupts.ppt
Interrupts.ppt
SasiBhushan22
 

Similar to Micro controller 8051 Interrupts (20)

Interrupts programming in embedded C using 8051
Interrupts programming in embedded C using 8051Interrupts programming in embedded C using 8051
Interrupts programming in embedded C using 8051
 
Embedded systems, lesson 16
Embedded systems, lesson 16Embedded systems, lesson 16
Embedded systems, lesson 16
 
Mc module5 ppt_msj
Mc module5 ppt_msjMc module5 ppt_msj
Mc module5 ppt_msj
 
DPA
DPADPA
DPA
 
Interrupt programming
Interrupt programming Interrupt programming
Interrupt programming
 
unit 3 a.pptxppppppppppppppppppppppppppp
unit 3 a.pptxpppppppppppppppppppppppppppunit 3 a.pptxppppppppppppppppppppppppppp
unit 3 a.pptxppppppppppppppppppppppppppp
 
Interrupt in 8051
Interrupt in 8051Interrupt in 8051
Interrupt in 8051
 
Unit 3 timer and counter and there application .pptx
Unit 3 timer and counter and there application .pptxUnit 3 timer and counter and there application .pptx
Unit 3 timer and counter and there application .pptx
 
Interrupt in ATMEGA328P.pptx
Interrupt in ATMEGA328P.pptxInterrupt in ATMEGA328P.pptx
Interrupt in ATMEGA328P.pptx
 
Interrupt.pptx
Interrupt.pptxInterrupt.pptx
Interrupt.pptx
 
Interrupts on 8086 microprocessor by vijay kumar.k
Interrupts on 8086 microprocessor by vijay kumar.kInterrupts on 8086 microprocessor by vijay kumar.k
Interrupts on 8086 microprocessor by vijay kumar.k
 
8 interrupt 8051
8 interrupt 80518 interrupt 8051
8 interrupt 8051
 
37471656 interrupts
37471656 interrupts37471656 interrupts
37471656 interrupts
 
Unit 5_interrupt programming_Part 1
Unit 5_interrupt programming_Part 1Unit 5_interrupt programming_Part 1
Unit 5_interrupt programming_Part 1
 
Microcontroller part 2
Microcontroller part 2Microcontroller part 2
Microcontroller part 2
 
Timing n interrupt.pptx
Timing n interrupt.pptxTiming n interrupt.pptx
Timing n interrupt.pptx
 
8051 Microcontroller Overview by Venkatrao Ramisetti
8051 Microcontroller Overview by Venkatrao Ramisetti 8051 Microcontroller Overview by Venkatrao Ramisetti
8051 Microcontroller Overview by Venkatrao Ramisetti
 
Interrupts
InterruptsInterrupts
Interrupts
 
Interrupts.ppt
Interrupts.pptInterrupts.ppt
Interrupts.ppt
 
Interrupts
InterruptsInterrupts
Interrupts
 

More from dharmesh nakum

Design of armature for dc motor
Design of armature for dc motorDesign of armature for dc motor
Design of armature for dc motor
dharmesh nakum
 
Synchronous motor drive
Synchronous motor driveSynchronous motor drive
Synchronous motor drive
dharmesh nakum
 
Braking and multi-quadrant operation of VSI drives,Cycloconverter based indu...
 Braking and multi-quadrant operation of VSI drives,Cycloconverter based indu... Braking and multi-quadrant operation of VSI drives,Cycloconverter based indu...
Braking and multi-quadrant operation of VSI drives,Cycloconverter based indu...
dharmesh nakum
 
Analysis of unsymmetrical faults using the bus impedance matrix, Faults throu...
Analysis of unsymmetrical faults using the bus impedance matrix, Faults throu...Analysis of unsymmetrical faults using the bus impedance matrix, Faults throu...
Analysis of unsymmetrical faults using the bus impedance matrix, Faults throu...
dharmesh nakum
 
Dc to Dc Converter (chopper)
Dc to Dc Converter (chopper)Dc to Dc Converter (chopper)
Dc to Dc Converter (chopper)
dharmesh nakum
 
UNDER GROUND CABLE (TYPES OF CABLE)
UNDER GROUND CABLE (TYPES OF CABLE)UNDER GROUND CABLE (TYPES OF CABLE)
UNDER GROUND CABLE (TYPES OF CABLE)
dharmesh nakum
 
Wireshark network analysing software
Wireshark network analysing softwareWireshark network analysing software
Wireshark network analysing software
dharmesh nakum
 

More from dharmesh nakum (7)

Design of armature for dc motor
Design of armature for dc motorDesign of armature for dc motor
Design of armature for dc motor
 
Synchronous motor drive
Synchronous motor driveSynchronous motor drive
Synchronous motor drive
 
Braking and multi-quadrant operation of VSI drives,Cycloconverter based indu...
 Braking and multi-quadrant operation of VSI drives,Cycloconverter based indu... Braking and multi-quadrant operation of VSI drives,Cycloconverter based indu...
Braking and multi-quadrant operation of VSI drives,Cycloconverter based indu...
 
Analysis of unsymmetrical faults using the bus impedance matrix, Faults throu...
Analysis of unsymmetrical faults using the bus impedance matrix, Faults throu...Analysis of unsymmetrical faults using the bus impedance matrix, Faults throu...
Analysis of unsymmetrical faults using the bus impedance matrix, Faults throu...
 
Dc to Dc Converter (chopper)
Dc to Dc Converter (chopper)Dc to Dc Converter (chopper)
Dc to Dc Converter (chopper)
 
UNDER GROUND CABLE (TYPES OF CABLE)
UNDER GROUND CABLE (TYPES OF CABLE)UNDER GROUND CABLE (TYPES OF CABLE)
UNDER GROUND CABLE (TYPES OF CABLE)
 
Wireshark network analysing software
Wireshark network analysing softwareWireshark network analysing software
Wireshark network analysing software
 

Recently uploaded

BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
MIGUELANGEL966976
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
nooriasukmaningtyas
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Ethernet Routing and switching chapter 1.ppt
Ethernet Routing and switching chapter 1.pptEthernet Routing and switching chapter 1.ppt
Ethernet Routing and switching chapter 1.ppt
azkamurat
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
Divyam548318
 
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
Mukeshwaran Balu
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
awadeshbabu
 
Swimming pool mechanical components design.pptx
Swimming pool  mechanical components design.pptxSwimming pool  mechanical components design.pptx
Swimming pool mechanical components design.pptx
yokeleetan1
 
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.pptPROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
bhadouriyakaku
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
Kamal Acharya
 
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
dxobcob
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 
01-GPON Fundamental fttx ftth basic .pptx
01-GPON Fundamental fttx ftth basic .pptx01-GPON Fundamental fttx ftth basic .pptx
01-GPON Fundamental fttx ftth basic .pptx
benykoy2024
 
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
ihlasbinance2003
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
anoopmanoharan2
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
ChristineTorrepenida1
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
aqil azizi
 
Online aptitude test management system project report.pdf
Online aptitude test management system project report.pdfOnline aptitude test management system project report.pdf
Online aptitude test management system project report.pdf
Kamal Acharya
 

Recently uploaded (20)

BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdfBPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
BPV-GUI-01-Guide-for-ASME-Review-Teams-(General)-10-10-2023.pdf
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Ethernet Routing and switching chapter 1.ppt
Ethernet Routing and switching chapter 1.pptEthernet Routing and switching chapter 1.ppt
Ethernet Routing and switching chapter 1.ppt
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
 
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
 
Swimming pool mechanical components design.pptx
Swimming pool  mechanical components design.pptxSwimming pool  mechanical components design.pptx
Swimming pool mechanical components design.pptx
 
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.pptPROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
 
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 
01-GPON Fundamental fttx ftth basic .pptx
01-GPON Fundamental fttx ftth basic .pptx01-GPON Fundamental fttx ftth basic .pptx
01-GPON Fundamental fttx ftth basic .pptx
 
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
 
Online aptitude test management system project report.pdf
Online aptitude test management system project report.pdfOnline aptitude test management system project report.pdf
Online aptitude test management system project report.pdf
 

Micro controller 8051 Interrupts

  • 1. Microcontroller 8051 Interrupts Present by: LAXMI INSTITUTION OF TECHNOLOGY Sr. no. Name Enrollment No. 1 Kulkarni Ajay 150863109004 2 Nakum Dharmesh M. 150863109005 3 Nayakvade Ragini B. 150863109006 4 Parmar Ashish V. 150863109007 Sub: MMCI 2150907
  • 2. Interrupts Programming  An interrupt is an external or internal event that interrupts the microcontroller to inform it that a device needs its service. Interrupts vs. Polling  A single microcontroller can serve several devices.  There are two ways to do that: ◦ interrupts ◦ polling.  The program which is associated with the interrupt is called the interrupt service routine (ISR) or interrupt handler.
  • 3. Interrupts vs. Polling  An interrupt is an external or internal event that interrupts the microcontroller ◦ To inform it that a device needs its service  A single microcontroller can serve several devices by two ways ◦ Interrupts  Whenever any device needs its service, the device notifies the microcontroller by sending it an interrupt signal  Upon receiving an interrupt signal, the microcontroller interrupts whatever it is doing and serves the device
  • 4. Interrupts vs. Polling (cont.) ◦ The program which is associated with the interrupt is called the interrupt service routine (ISR) or interrupt handler ◦ Polling  The microcontroller continuously monitors the status of a given device ◦ ex. JNB TF, target  When the conditions met, it performs the service  After that, it moves on to monitor the next device until every one is serviced ◦ Polling can monitor the status of several devices and serve each of them as certain conditions are met  The polling method is not efficient, since it wastes much of the microcontroller’s time by polling devices that do not need service
  • 5. Interrupts vs. Polling (cont.)  The advantage of interrupts is: ◦ The microcontroller can serve many devices (not all at the same time)  Each device can get the attention of the microcontroller based on the assigned priority  For the polling method, it is not possible to assign priority since it checks all devices in a round-robin fashion ◦ The microcontroller can also ignore (mask) a device request for service  This is not possible for the polling method
  • 6. Steps in executing an interrupt  Finish current instruction and saves the PC on stack.  Jumps to a fixed location in memory depend on type of interrupt  Starts to execute the interrupt service routine until RETI (return from interrupt)  Upon executing the RETI the microcontroller returns to the place where it was interrupted. Get pop PC from stack
  • 7. Interrupt Sources  Original 8051 has 6 sources of interrupts ◦ Reset ◦ Timer 0 overflow ◦ Timer 1 overflow ◦ External Interrupt 0 ◦ External Interrupt 1 ◦ Serial Port events (buffer full, buffer empty, etc)  Enhanced version has 22 sources ◦ More timers, programmable counter array, ADC, more external interrupts, another serial port (UART)
  • 8. Interrupt Vectors Each interrupt has a specific place in code memory where program execution (interrupt service routine) begins. External Interrupt 0: 0003h Timer 0 overflow: 000Bh External Interrupt 1: 0013h Timer 1 overflow: 001Bh Serial : 0023h Timer 2 overflow(8052+) 002bh Note: that there are only 8 memory locations between vectors.
  • 9. SJMP main ORG 03H ljmp int0sr ORG 0BH ljmp t0sr ORG 13H ljmp int1sr ORG 1BH ljmp t1sr ORG 23H ljmp serialsr ORG 30H main: … END ISRs and Main Program in 8051
  • 10. Interrupt Enable (IE) register All interrupt are disabled after reset We can enable and disable them bye IE
  • 11. Enabling and disabling an interrupt by bit operation Recommended in the middle of program SETB EA ;Enable All SETB ET0 ;Enable Timer0 ovrf SETB ET1 ;Enable Timer1 ovrf SETB EX0 ;Enable INT0 SETB EX1 ;Enable INT1 SETB ES ;Enable Serial port by mov instruction Recommended in the first of program MOV IE, #10010110B SETB IE.7 SETB IE.1 SETB IE.3 SETB IE.0 SETB IE.2 SETB IE.4
  • 12. Timer ISR  Notice that ◦ There is no need for a “CLR TFx” instruction in timer ISR ◦ 8051 clears the TF internally upon jumping to ISR  Notice that ◦ We must reload timer in mode 1 ◦ There is no need on mode 2 (timer auto reload)
  • 13. External interrupt type control  By low nibble of Timer control register TCON  IE0 (IE1): External interrupt 0(1) edge flag. ◦ set by CPU when external interrupt edge (H-to-L) is detected. ◦ Does not affected by H-to-L while ISR is executed(no int on int) ◦ Cleared by CPU when RETI executed. ◦ does not latch low-level triggered interrupt  IT0 (IT1): interrupt 0 (1) type control bit. ◦ Set/cleared by software ◦ IT=1 edge trigger ◦ IT=0 low-level trigger TF1 TR1 TF0 TR0 IE1 IT1 IE0 IT0 Timer 1 Timer0 for Interrupt (MSB) (LSB)
  • 14. External Interrupts IE0 (TCON.3) 0003 INT0 (Pin 3.2) 0 1 2 IT0 Edge-triggered Level-triggered (default) IE1 (TCON.3) INT0 (Pin 3.3) 0 1 2 IT1 Edge-triggered Level-triggered (default) 0013
  • 15. Interrupt Priorities  What if two interrupt sources interrupt at the same time?  The interrupt with the highest PRIORITY gets serviced first.  All interrupts have a power on default priority order. 1. External interrupt 0 (INT0) 2. Timer interrupt0 (TF0) 3. External interrupt 1 (INT1) 4. Timer interrupt1 (TF1) 5. Serial communication (RI+TI)  Priority can also be set to “high” or “low” by IP reg.
  • 16. Interrupt Priorities (IP) Register IP.7: reserved IP.6: reserved IP.5: timer 2 interrupt priority bit(8052 only) IP.4: serial port interrupt priority bit IP.3: timer 1 interrupt priority bit IP.2: external interrupt 1 priority bit IP.1: timer 0 interrupt priority bit IP.0: external interrupt 0 priority bit --- PX0PT0PX1PT1PSPT2---
  • 17. Interrupt Priorities Example  MOV IP , #00000100B or SETB IP.2 gives priority order 1. Int1 2. Int0 3. Timer0 4. Timer1 5. Serial  MOV IP , #00001100B gives priority order 1. Int1 2. Timer1 3. Int0 4. Timer0 5. Serial --- PX0PT0PX1PT1PSPT2---
  • 18. Interrupt inside an interrupt --- PX0PT0PX1PT1PSPT2---  A high-priority interrupt can interrupt a low-priority interrupy  All interrupt are latched internally  Low-priority interrupt wait until 8051 has finished servicing the high-priority interrupt