Академический Документы
Профессиональный Документы
Культура Документы
MicroprocessorandInterfaces
Interrupts
Interrupts
Interruptisaprocesswhereanexternaldevicecanget
attentionofthemicroprocessor
tt ti
f th
i
TheprocessstartsfromtheI/Odevice
Theprocessisasynchronous
ClassificationofInterrupts
Maskable Interrupts(CanbedelayedorRejected)
NonMaskable Interrupts(CannotbedelayedorRejected)
ClassificationofInterrupts
p
Vectored(theaddressoftheserviceroutineishardwired)
Nonvectored(theaddressoftheserviceroutineneedstobesupplied
externallybythedevice)
Interrupts
Aninterruptisconsideredtobeanemergency
p
g y
signalthatmaybeserviced
TheMicroprocessormayrespondtoitassoonas
possible
WhathappenswhenMPisinterrupted?
pp
p
WhentheMicroprocessorreceivesaninterruptsignal,
itcompletesthecurrentlyexecutingprogramand
then jumps to an Interrupt Service Routine (ISR) to
thenjumpstoanInterruptServiceRoutine(ISR)to
respondtotheincominginterrupt
EachinterruptwillmostprobablyhaveitsownISR
Responding to Interrupts
RespondingtoInterrupts
Responsetoaninterruptmaybeimmediateordelayed
dependingonwhethertheinterruptismaskable or
nonmaskable andwhetherinterruptsarebeing
maskedornot
Therearetwowaysofredirectingtheexecutiontothe
ISR depending on whether the interrupt is vectored or
ISRdependingonwhethertheinterruptisvectoredor
nonvectored.
Vectored:Theaddressofthesubroutineisalreadyknown
to the Microprocessor
totheMicroprocessor
NonVectored:Thedevicewillhavetosupplytheaddress
ofthesubroutinetotheMicroprocessor
RST5.5,RST6.5,RST7.5areallautomaticallyvectored
RST5.5,RST6.5,andRST7.5areallmaskable
TRAPistheonlynonmaskable interruptinthe8085
TRAPisalsoautomaticallyvectored
TRAP is also automatically vectored
Maskable
Vectored
INTR
Yes
No
RST5.5
Yes
Yes
RST6.5
Yes
Yes
RST7.5
Yes
Yes
TRAP
No
Yes
Example
Example
Let
Let,adeviceinterruptstheMicroprocessorusing
a device interrupts the Microprocessor using
theRST7.5interruptline.
RST
RST7.5interruptisvectored
7.5 interrupt is vectored
Microprocessorknows,inwhichmemorylocationit
hastogousingacallinstructiontogettheISRaddress
RST7.5isknowsasCall003ChtoMicroprocessor
Microprocessorgoesto003Clocationandwillgeta
JMPinstructiontotheactualISRaddress
TheMicroprocessorwillthen,jumptotheISRlocation
The8085NonVectoredInterrupt
Process
Theinterruptprocessshouldbeenabledusing
e te upt p ocess s ou d be e ab ed us g
theEIinstruction
p
g
The8085checksforaninterruptduringthe
executionofeveryinstruction
IfINTRishigh,MPcompletescurrentinstruction,
disablestheinterruptandsendsINTA(Interrupt
acknowledge)signaltothedevicethat
interrupted
INTAallowstheI/OdevicetosendaRST
instruction through data bus
instructionthroughdatabus
The8085NonVectoredInterrupt
Process
UponreceivingtheRSTinstruction,MPsavesthe
p
g
,
memorylocationofthenextinstructiononthe
stackandtheprogramistransferredtocall
location (ISR Call) specified by the RST instruction
location(ISRCall)specifiedbytheRSTinstruction
MicroprocessorPerformstheISR
ISRmustincludethe
ISR must include the EI
EI instructiontoenablethe
instruction to enable the
furtherinterruptwithintheprogram
RETinstructionattheendoftheISRallowsthe
MP
MPtoretrievethereturnaddressfromthestack
i
h
dd
f
h
k
andtheprogramistransferredbacktowherethe
p g
programwasinterrupted
p
The8085NonVectoredInterrupt
Process
The8085recognizes8RESTARTinstructions:RST0
g
RST7
eachofthesewouldsendtheexecutiontoapredeterminedhard
wiredmemorylocation:
RestartInstruction
Equivalentto
RST0
CALL0000H
RST1
CALL 0008H
CALL0008H
RST2
CALL0010H
RST3
CALL0018H
RST4
CALL0020H
RST5
CALL0028H
RST6
CALL0030H
RST7
CALL0038H
Restart Sequence
RestartSequence
Therestartsequenceismadeupofthree
e esta t seque ce s ade up o t ee
machinecycles
Inthe1stmachinecycle:
ThemicroprocessorsendstheINTAsignal
WhileINTAisactivethemicroprocessorreadsthedatalines
expectingtoreceive,fromtheinterruptingdevice,the
p
g
p g
opcode forthespecificRSTinstruction
Inthe2ndand3rdmachinecycles:
the
the16bitaddressofthenextinstructionissavedonthe
16 bit address of the next instruction is saved on the
stack
Thenthemicroprocessorjumpstotheaddressassociated
with the specified RST instruction
withthespecifiedRSTinstruction
TheRST5instructionisexactlyequivalenttoCALL
0028H
Therefore,theINTRmustremainactivefor17.5Tstates
Iff=3MHZthenT=1/fandso,INTRmustremainactivefor[
(1/3MHZ) * 17 5 5 8 i
(1/3MHZ)*17.55.8microseconds]
d]
Therefore,INTRshouldbeturnedoffassoon
as the INTA signal is received
astheINTAsignalisreceived
Therefore,theansweris:onlyifweallowitto.
,
y
IftheEIinstructionisplacedearlyintheISR,other
interruptmayoccurbeforetheISRisdone
The3outputscarrytheindexofthehighest
The 3 outputs carry the index of the highest
priorityactiveinput
RST instructionssopcodes
RSTinstruction
opcodes
Instruction
Opcode
RST0
C7(11000111)
RST1
(
)
CF(11001111)
RST2
D7(11010111)
RST3
DF(11011111)
RST4
E7(11100111)
(
)
RST5
EF(11101111)
RST6
F7(11110111)
RST7
FF(11111111)
Theonedrawbacktothisschemeisthattheonly
waytochangethepriorityofthedevices
t h
th
i it f th d i
connectedtothe74366(Tristatedbuffer)isto
reconnectthehardware
I6
I5
I4
I3
I2
I1
I0
A2
A1
A0
The8085Maskable/Vectored
Interrupts
The8085has3Maskable/Vectoredinterruptinputs
/
p p
RST5.5,RST6.5,RST7.5
Theyareallmaskable
Theyareautomaticallyvectoredaccordingtothefollowingtable:
They are automatically vectored according to the following table:
Interrupt
Vector
RST5.5
002CH
RST6.5
0034H
RST7.5
003CH
ThevectorsfortheseinterruptfallinbetweenthevectorsfortheRST
instructions.ThatswhytheyhavenameslikeRST5.5(RST5andahalf)
Throughindividualmaskflipflopsthatcontrolthe
availabilityoftheindividualinterrupts
Theseflipflopscontroltheinterruptsindividually
Maskable Interruptsandvector
locations
The8085Maskable/VectoredInterrupt
Process
Theinterruptprocessshouldbeenabledusing
p p
g
theEIinstruction
The8085checksforaninterruptduringthe
execution of every instruction
executionofeveryinstruction
Ifthereisaninterrupt,andiftheinterruptis
enabled using the interrupt mask, the
enabledusingtheinterruptmask,the
microprocessorwillcompletetheexecuting
instruction,andresettheinterruptflipflop
Themicroprocessorthenexecutesacall
Th
i
h
ll
instructionthatsendstheexecutiontothe
pp p
p
appropriatelocationintheinterruptvectortable
The8085Maskable/VectoredInterrupt
Process
Whenthemicroprocessorexecutesthecall
e t e c op ocesso e ecutes t e ca
instruction,itsavestheaddressofthenext
instructiononthestack
Themicroprocessorjumpstothespecificservice
routine
Theserviceroutinemustincludetheinstruction
EItoreenabletheinterruptprocess
Attheendoftheserviceroutine,theRET
At th
d f th
i
ti th RET
instructionreturnstheexecutiontowherethe
program was interrupted
programwasinterrupted
Bit3(MaskSetEnable MSE)isanenableforsettingthe
mask
Ifitissetto0themaskisignoredandtheoldsettingsremain
g
g
Ifitissetto1,thenewsettingareapplied
TheSIMinstructionisusedformultiplepurposesandnotonly
forsettinginterruptmasks
ItisalsousedtocontrolfunctionalitysuchasSerialDataTransmission
Therefore,bit3isnecessarytotellthemicroprocessorwhetherornot
theinterruptmasksshouldbemodified
Bit4oftheaccumulatorintheSIMinstructionallowsexplicitly
resettingtheRST7.5memoryevenifthemicroprocessordidnot
respond to it
respondtoit
Bit5isnotusedbytheSIMinstruction
UsingtheSIMInstructiontoModify
theInterruptMasks
h
k
Example:
Example:Settheinterruptmaskssothat
Set the interrupt masks so that
RST5.5isenabled,RST6.5ismasked,and
RST7 5 is enabled
RST7.5isenabled
First,determinethecontentsoftheaccumulator
Triggering Levels
TriggeringLevels
RST7.5ispositiveedgesensitive
RST 7.5 is positive edge sensitive
WhenapositiveedgeappearsontheRST7.5line,a
logic1isstoredintheflipflopasapendinginterrupt
Sincethevaluehasbeenstoredintheflipflop,theline
h
l h b
d
h fl fl
h l
doesnothavetobehighwhenthemicroprocessor
checksfortheinterrupttoberecognized
Thelinemustgotozeroandbacktoonebeforeanew
interruptisrecognized
RST6.5andRST5.5arelevelsensitive
RST 6 5 and RST 5 5 are level sensitive
Theinterruptingsignalmustremainpresentuntilthe
microprocessorchecksforinterrupts
HowRIMsetstheAccumulators
d ff
differentbits
b
Bit3showswhetherthemaskable interrupt
processisenabledornot
ItreturnsthecontentsoftheInterruptEnableFlipFlop
Itcanbeusedbyaprogramtodeterminewhetherornot
interrupts are enabled
interruptsareenabled
Bit7isusedforSerialDataInput
Bit 7 is used for Serial Data Input
TheRIMinstructionreadsthevalueoftheSIDpinonthe
microprocessorandreturnsitinthisbit
Pending Interrupts
PendingInterrupts
Since
Sincethe8085hasfiveinterruptlines,
the 8085 has five interrupt lines
interruptsmayoccurduringanISRandremain
pending
UsingtheRIMinstruction,itispossibletoreadthe
status of the interrupt lines and find if there are
statusoftheinterruptlinesandfindifthereare
anypendinginterrupts
TRAP
TRAP
TRAPistheonlynonmaskable
st eo y o
as ab e interrupt
te upt
Itdoesnotneedtobeenabledbecauseitcannotbe
disabled
Ithasthehighestpriorityamongstinterrupts
Itisedgeandlevelsensitive
Itneedstobehighandstayhightoberecognized
Onceitisrecognized,itwontberecognizedagain
until it goes low then high again
untilitgoeslow,thenhighagain
TRAPisusuallyusedforpowerfailureand
emergency shutoff
emergencyshutoff
Maskable
Masking
Method
Vectored
Memory
Triggering
Method
INTR
Yes
DI / EI
DI/EI
No
No
Level
S ii
Sensitive
RST5.5/
RST6.5
Yes
DI/EI
SIM
Yes
No
Level
Sensitive
RST7.5
Yes
DI/EI
SIM
Yes
Yes
Edge
Sensitive
TRAP
No
None
Yes
No
Level&Edge
Sensitive