Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book...

29
Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth L.Short and they are reproduced for educational purposes only.

Transcript of Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book...

Page 1: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.

Interrupts

Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth L.Short and they are reproduced for educational purposes only.

Page 2: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.

Interrupts

Interrupts increase processor system efficiency by letting I/O device request CPU time only when that device needs immediate attention.

An interrupt is a subroutine call initialized by external hardware.

Page 3: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.
Page 4: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.

Interrupt Request

The request is asynchronous it may occur at any point in a program’s execution.

Page 5: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.

Interrupt Input Types

Nonmaskable interrupt input The MPU is interrupted when a logic signal is

applied to this type of input. Maskable interrupt input

The MPU is interrupted ONLY if that particular input is enabled.

It is enabled or disabled under program control. If disabled, an interrupt signal is ignored by the MPU.

Page 6: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.

Maskable & Nonmaskable INT

Page 7: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.

Sequence of Actions

Page 8: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.

Sequence of Actions

1. The processing of the current instruction is completed.

2. An interrupt machine cycle is executed during which the PC is saved and control is transferred to an appropriate memory location.

Page 9: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.

Sequence of Actions

3. The state of the MPU is saved.

4. If more than one I/O device is associated with the location transferred to, the highest priority device requesting an interrupt is identified.

Page 10: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.

Sequence of Actions

5. A subroutine is executed which services the interrupt I/O device.

6. The saved state of the microprocessor is restored.

7. Control is returned to the instruction that follows the interrupted instruction.

Page 11: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.

8085A Interrupt Structure

There are 5 interrupt inputs: TRAP (nonmaskable) RST7.5 RST6.5 RST5.5 INTR

Page 12: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.

8085A Interrupt Structure

When the 8085A is reset: Its internal interrupt enable flip-flop (INTE FF) is

reset. This disables ALL the maskable interrupts. So, the MPU only responds to TRAP. Maskable interrupts must be enabled under

program control. Let’s prove and find out which address the TRAP

would go?

Page 13: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.

RST7.5, RST6.5, RST5.5

Two program steps are required to enable these interrupts: Setting the interrupt

masks Enabling the interrupts

SIM (set interrupt mask) is the instruction to mask each interrupt independently.

Page 14: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.

8085A Interrupt Structure

We can gather the status of maskable interrupt and interrupt enable/disable from the instruction RIM (Read Interrupt Mask)

Page 15: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.

INTR

Although INTR is a maskable interrupt it does NOT need SIM to get enabled. Just instruction EI is enough.

Page 16: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.

Interrupt Inputs’ Sensitivity

Level sensitive RST6.5 and RST 5.5 are high level sensitive The signal at these pins must be maintained until

the interrupt is acknowledged External interrupt request flip-flops are required

Page 17: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.

Interrupt Inputs’ Sensitivity

Edge sensitive RST7.5 (Rising edge sensitive) Only a pulse is required to set the interrupt

request this request is remembered until the 8085A responds to the interrupt or until the request is reset by the SIM instruction or a /RESET IN signal.

The interrupt request flip-flops for RST7.5 is internal to the microprocessor

Page 18: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.

Interrupt Inputs’ Sensitivity

Both edge and level sensitive TRAP

Must make a low-to-high transition and remain high to be acknowledged.

After acknowledgement, it is NOT recognized again until it goes low, then high again and remains high.

To avoid false triggering due to noise/logic glitches.

Page 19: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.
Page 20: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.

Remember This?

Page 21: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.
Page 22: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.

BUS IDLE (BI) Machine Cycle

TRAP, RST5.5, RST6.5, and RST7.5

RST (internal)

((SP) – 1) (PCH)

((SP) – 2) (PCL)

(SP) (SP) – 2

(PC) restart address

Page 23: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.

INTERRUPT ACKNOWLEDGE (INA) Machine Cycle

INTR ( 0 =< n =< 7 )

RST n

((SP) – 1) (PCH)

((SP) – 2) (PCL)

(SP) (SP) – 2

(PC) 8*n External logic must generate interrupt

vector as 11NNN111 at the data bus

Page 24: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.
Page 25: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.

Priority Interrupt Structures

8085A have an internally established, fixed, multilevel priority structure.

From highest to lowest: TRAP

Usually reserved to handle catastrophies such as power failures.

RST7.5 RST6.5 RST5.5 INTR

Page 26: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.
Page 27: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.
Page 28: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.
Page 29: Interrupts Disclaimer: All diagrams and figures in this presentation are scanned from the book “Microprocessors and Programmed Logic” authored by Kenneth.