0% found this document useful (0 votes)
30 views4 pages

Interrupt Service Routine (Isr) : The Operation of An Interrupt Sequence

The document discusses interrupt service routines and how they work. It describes different methods for determining which device is requesting service, including software polling, hardware polling, and hardware identification. It provides an example of using software polling to handle interrupts on a PIC16F84 microcontroller and increment a port on each interrupt.

Uploaded by

MANIKANDAN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views4 pages

Interrupt Service Routine (Isr) : The Operation of An Interrupt Sequence

The document discusses interrupt service routines and how they work. It describes different methods for determining which device is requesting service, including software polling, hardware polling, and hardware identification. It provides an example of using software polling to handle interrupts on a PIC16F84 microcontroller and increment a port on each interrupt.

Uploaded by

MANIKANDAN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

7/7/2015

INTERRUPTISR

INTERRUPTSERVICEROUTINE(ISR)
Ifmorethanonedeviceisconnectedtotheinterruptline,theprocessorneedstoknowtowhichdevice
service routine it should branch to. The identification of the device requesting service can be done in
eitherhardwareorsoftware,oracombinationofboth.Thethreemainmethodsare:
1. SoftwarePolling,
2. HardwarePolling,(DaisyChain),
3. HardwareIdentification(VectoredInterrupts).
4.

TheOperationofanInterruptsequence:
1.TheCPUfinishesthepresentinstruction.
2.ThereturnaddressHighByteisPushedontotheStack.
3.TheStackPointer(SP)isdecremented
4.ThereturnaddressLowByteisPushedontotheStack
5.TheStackPointer(SP)isdecremented
6.ThemicroprocessorservicestheInterruptServiceRoutine(ISR).
7.Whilereturningfromtheinterruptserviceroutinebytheinstruction(RTI)thereturnaddressLowand
HighbytesarePulledfromthestackandplacedintotheProgrammeCounter(PC).
8.Mainprogrammecontinues.

SoftwarePollingDeterminationoftheRequestingDevice
Asoftwareroutineisusedtoidentifythedevicerequestingservice.Asimplepollingtechniqueisused,
eachdeviceischeckedtoseeifitwastheoneneedingservice.

http://www.electronics.dit.ie/staff/tscarff/16F84/interrupt_ISR.htm

1/4

7/7/2015

INTERRUPTISR

Having identified the device, the processor then branches to the appropriate interrupthandlingroutine
addressforthegivendevice.Theorderinwhichthedevicesappearinthepollingsequencedetermines
theirpriority.

Thefollowingexampleshowsatypicalwayofhandlinginterrupts.PIC16F84hasgotasinglelocation
forstoringtheaddressofaninterruptsubroutine.Thismeansthatfirstweneedtodetectwhichinterrupt
isathand(ifmorethanoneinterruptsourceisavailable),andthenwecanexecutethatpartofa
programmewhichreferstothatinterrupt.
TIMER0INTERRUPT

http://www.electronics.dit.ie/staff/tscarff/16F84/interrupt_ISR.htm

2/4

7/7/2015

INTERRUPTISR

FOR16F84RUNNINGAT4MHz
***************************************************
Thiscodewillgenerateatimer0interruptevery1/15ofasecondandincrementportboneveryinterrupt
***************************************************
theLISTcommandisanassemblerdirectiveandtellstheassemblerwhichcontrollerithastoassemblethecodeforandinwhatformatthecodeshouldbe
generated.
LISTP=16F84,F=INHX8M
whenwritingcodeitiseasiertoputnamestoregistersorfixednumberstodothisweusetheEQUcommand,thisisanotherassemblerdirectiveanditinstructs
theassemblertosubstitutethevalueaftertheEQUcommandtothelabelbeforetheEQUcommand.
INADDEQU00H
TMR0EQU01H
PCEQU02H
STATUSEQU03H
FSREQU04H
PORTAEQU05H
PORTBEQU06H
INTCONEQU0BH
EECON1EQU88H

TRISAEQU85H
TRISBEQU86H

OPTEQU81H

W_STOREEQU20H
STATUS_STOREEQU21H

BITEQUATES
CEQU00
ZEQU02
RP0EQU05
GIEEQU07
EEIEEQU06
T0IEEQU05
INTEEQU04
http://www.electronics.dit.ie/staff/tscarff/16F84/interrupt_ISR.htm

3/4

7/7/2015

INTERRUPTISR

RBIE

http://www.electronics.dit.ie/staff/tscarff/16F84/interrupt_ISR.htm

4/4

You might also like