Docsity

Interrupts - Electrical Engineering - Lecture Slides, Slides of Electrical Engineering

Partial preview of the text

Download Interrupts - Electrical Engineering - Lecture Slides and more Slides Electrical Engineering in PDF only on Docsity!

INTRODUCTION^ ๏‚—

Interrupt is a process where an externaldevice can get the attention of themicroprocessor.^ ๏‚—

The process starts from the I/O device ๏‚— The process is asynchronous. ๏‚—^

An interrupt is considered to be anemergency signal that may be serviced.^ ๏‚—

The Microprocessor may respond to it assoon as possible.

Interrupts^ When the interrupt signal arrives:

๏‚ง^

The processor will break its routine ๏‚ง^

Go to a different routine (interrupt service routine) ๏‚ง^

Complete the interrupt service routine(ISR) ๏‚ง^

Go back to the โ€œregularโ€ routine

In order to execute an interrupt routine, the Interrupts

processor:^ ๏‚ง

Should be able to

accept

interrupts (interrupt

enable) ๏‚ง^

Save the last content of the program counter ๏‚ง^

Know where to go in program memory to execute the ISR ๏‚ง^

Tell the outside world that it is executing an interrupt ๏‚ง^

Go back to the saved PC location when finished.

Interrupts in

Main

routine

Interrupt

Save program counter

Disable interrupts

Send

out interupt acknowledge

Service

routine

INTA

Go^

to service routine

Get original program counter Go back

EI RET

CLASSIFICATION OFINTERRUPTS

-^

Interrupts can be classified into two types:^ ๏‚—^

Maskable Interrupts (Can be delayed orRejected) ๏‚—^

Non-Maskable Interrupts (Can not bedelayed or Rejected)

-^

Interrupts can also be classified into:

๏‚—^

Vectored (the address of the serviceroutine is hard-wired) ๏‚—^

Non-vectored (the address of the serviceroutine needs to be supplied externallyby the device)

Maskable & Nonmaskable INT

Response to Interrupt^ ๏‚—

Responding to an interrupt may beimmediate or delayed depending onwhether the interrupt is maskable or non-maskable and whether interrupts are beingmasked or not. ๏‚— MP completes its current machine cycle.

Response to Interrupt^ 1. The processing of the current instruction is

completed.

  1. An interrupt machine cycle is executed

during which the PC is saved and control istransferred to an appropriate memorylocation.

  1. The state of the MPU is saved.4. If more than one I/O device is associated

with the location transferred to, the highestpriority device requesting an interrupt isidentified.

Response to Interrupt

A subroutine is executed which servicesthe interrupt I/O device.

The saved state of the microprocessor isrestored.

Control is returned to the instruction thatfollows the interrupted instruction.

INTERRUPTS ๏‚—^ The โ€˜EIโ€™ instruction is a one byte instructionand is used to Enable the maskableinterrupts. ๏‚—^ The โ€˜DIโ€™ instruction is a one byte instructionand is used to Disable the maskableinterrupts. ๏‚—^ The has a single Non-Maskable interrupt.

INTERRUPTS ๏‚—^ The has 5 interrupt inputs.

๏‚—^

The INTR input.^ ๏‚—^

The INTR input is the only non-vectoredinterrupt. ๏‚—^

INTR is maskable using the EI/DIinstruction pair. ๏‚—^

RST 5.5, RST 6.5, RST 7.5 are allautomatically vectored.^ ๏‚—^

RST 5.5, RST 6.5, and RST 7.5 are allmaskable.

INTERRUPTS

TRAPRST7.5RST6.5RST 5.5INTRINTA

Vectored Interrupts^ ๏‚—

An interrupt vector is a pointer to where theISR is stored in memory. ๏‚— All interrupts (vectored or otherwise) aremapped onto a memory area called theInterrupt Vector Table (IVT). ๏‚— The IVT is usually located in memory page00 (0000H - 00FFH).