Interrupt Handling: 8259A PIC

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

How does using multiple peripherals typically manifest in terms of interrupt signals for a processor with a single INTR signal?

  • Each peripheral connects directly to the processor's interrupt pins, increasing processing speed.
  • The processor ignores interrupts from all but the highest priority peripheral to avoid conflicts.
  • The processor dynamically allocates additional INTR signals as new peripherals are added.
  • They appear as a single issue which can be solved by ORing the interrupt signals from the peripherals. (correct)

What critical issue arises when multiple peripherals simultaneously drive the data bus with their IRQ numbers?

  • The interrupt controller merges the IRQ numbers into a single, composite value.
  • The processor can differentiate between the sources.
  • A conflict occurs known as 'bus contention', leading to system instability or incorrect interrupt service routine execution. (correct)
  • Increase in the overall system performance due to parallel processing of interrupts.

What benefit does using a programmable interrupt controller (PIC) offer in managing multiple peripheral interrupts?

  • It allows peripherals to directly access the processor's memory, bypassing interrupt requests.
  • It completely eliminates the need for interrupt service routines.
  • Dynamically manages and concatenates the interrupts from multiple peripherals. (correct)
  • Automatically increases the clock speed of the processor for faster interrupt handling.

What is the primary role of the Intel 8259 PIC in a computer system?

<p>To concatenate interrupts from the peripherals and handling the IRQ. (C)</p>
Signup and view all the answers

How does the processor typically interface with the 8259 PIC?

<p>As an I/O peripheral. (B)</p>
Signup and view all the answers

Which of the following is a key feature of the 8259A PIC regarding its compatibility with interrupt types?

<p>Supports both edge and level triggered interrupts. (A)</p>
Signup and view all the answers

What supply voltage is required for the Intel 8259A PIC to operate?

<p>5V (D)</p>
Signup and view all the answers

When multiple peripherals are connected through an 8259A PIC, what is the maximum number of interrupts that can be managed through cascading?

<p>64 (C)</p>
Signup and view all the answers

What are the data bus pins (D0-D7) on the 8259A PIC used for?

<p>Communicating interrupt vectors and control words with the processor. (B)</p>
Signup and view all the answers

What is the function of the 'INT' pin on the 8259A PIC?

<p>To signal to the processor that an interrupt request is pending. (C)</p>
Signup and view all the answers

What is the purpose of the 'INTA' pin on the 8259A PIC?

<p>To receive an interrupt acknowledge pulse from the processor. (D)</p>
Signup and view all the answers

What is the role of Initialization Command Words (ICWs) in the context of the 8259A PIC?

<p>To configure the operational modes and parameters of the 8259A PIC. (A)</p>
Signup and view all the answers

What condition must be met for a command issued to the 8259A to be interpreted as Initialization Command Word 1 (ICW1)?

<p>Address line A0 = 0 and Data line D4 = 1 (D)</p>
Signup and view all the answers

How many Initialization command words are required to bring the 8259A to a starting point?

<p>2 to 4 bytes (B)</p>
Signup and view all the answers

What is the purpose of ICW2 in the initialization sequence of the 8259A PIC?

<p>To define the interrupt type (IRQ number). (C)</p>
Signup and view all the answers

In ICW3, what does a bit value of '1' indicate regarding IR inputs and slave 8259 connections in cascade mode?

<p>The IR input is connected to a slave 8259. (C)</p>
Signup and view all the answers

When is ICW4 relevant in the initialization process of the 8259A PIC?

<p>Only when the IC4 bit is set in ICW1. (C)</p>
Signup and view all the answers

What is the main function of Operational Command Words (OCWs) in the 8259A PIC?

<p>To dynamically alter the 8259A's behavior after initialization. (B)</p>
Signup and view all the answers

What is the function of OCW1 in the 8259A PIC?

<p>To set and clear the interrupt mask bits. (D)</p>
Signup and view all the answers

In the context of OCW1, what does setting a mask bit to '1' indicate?

<p>The channel is masked (inhibited) from generating interrupt requests. (D)</p>
Signup and view all the answers

What is the default operating mode of the 8259 PIC upon initialization?

<p>Fully Nested Mode (B)</p>
Signup and view all the answers

In Fully Nested Mode, how are interrupt requests prioritized?

<p>Based on the order from 0 through 7, with 0 having the highest priority. (B)</p>
Signup and view all the answers

What happens to the Interrupt Request Register (IRR) during the first INTA pulse in Fully Nested Mode?

<p>It is frozen, and the priority resolver identifies the highest unmasked interrupt. (D)</p>
Signup and view all the answers

If IR3 and IR5 both become high simultaneously, which interrupt is serviced first in Fully Nested Mode?

<p>IR3, because it has a higher priority. (D)</p>
Signup and view all the answers

What is the significance of the Automatic End of Interrupt (AEOI) bit in ICW4?

<p>It controls whether the ISR bit is automatically cleared at the end of the second INTA pulse. (B)</p>
Signup and view all the answers

What command is typically used to signal the end of an interrupt service routine (ISR)?

<p>OCW2 (A)</p>
Signup and view all the answers

If the 8259 is configured in fully nested mode and AEOI is not set (normal EOI), what is a potential issue concerning interrupt service routines?

<p>More than one ISR bit can be set simultaneously. (C)</p>
Signup and view all the answers

What are the two main types of EOI (End of Interrupt) commands?

<p>Non-specific and specific. (D)</p>
Signup and view all the answers

When a non-specific EOI command is issued, which ISR bit is cleared?

<p>The ISR bit corresponding to the highest priority interrupt. (A)</p>
Signup and view all the answers

What happens in Automatic Rotation Mode to a device after its interrupt has been serviced?

<p>It receives the lowest priority. (C)</p>
Signup and view all the answers

Which OCW is used to configure the 8259 PIC for Automatic Rotation Mode?

<p>OCW2 (D)</p>
Signup and view all the answers

What is the key characteristic of Special Mask Mode in the 8259 PIC regarding interrupt masking?

<p>Only explicitly masked interrupts in the IMR are inhibited, while all others are propagated. (B)</p>
Signup and view all the answers

Which OCW is used to configure the Special Mask Mode in the 8259 PIC?

<p>OCW3 (D)</p>
Signup and view all the answers

In Polling Mode, how does the processor determine if an interrupt request is pending?

<p>It polls the 8259 directly to check for pending interrupts. (C)</p>
Signup and view all the answers

What is the effect of setting the P bit in OCW3 when using Polling Mode?

<p>The next read operation after writing OCW3 with the P bit set will return a pending interrupt (if any). (D)</p>
Signup and view all the answers

In Polling Mode, what does a '1' indicate in the highest bit (D7) of the poll command response?

<p>There is a pending interrupt. (B)</p>
Signup and view all the answers

While in Polling Mode, If an OCW3 is used to configure to read Interupt Request Register(IRR), all the subsequent read operations with A0 bit set to ______ will return the IRR status

<p>0 (A)</p>
Signup and view all the answers

Imagine a scenario where an 8259A PIC is in fully nested mode with AEOI (Automatic End of Interrupt) enabled. An interrupt request comes in on IR4. Before the ISR for IR4 completes, an interrupt request arrives on IR2. What will happen?

<p>The 8259A will immediately preempt the ISR for IR4 and begin executing the ISR for IR2, as IR2 has higher priority, and the AEOI automatically clears the ISR bit. (A)</p>
Signup and view all the answers

Flashcards

Why can't you just OR the interrupt signals?

A single INTR signal is not sufficient for multiple peripherals; ORing interrupt signals may not solve the interrupt type (IRQ number) issue during the interrupt ACK cycle.

What is an Interrupt Controller (PIC)?

A component that sits between the processor and peripherals, concatenating interrupts and handling IRQ.

Intel 8259 PIC

The Intel 8259 PIC is a popular programmable interrupt controller used in 8086 and later processor-based systems.

8259 as I/O peripheral

The processor sees the 8259 as an I/O peripheral; it Comes in a 28-bit DIP or PLCC package with a 5V supply.

Signup and view all the flashcards

8259 features

Requires no separate clock, supporting 8 interrupts, and up to 64 through cascading.

Signup and view all the flashcards

8259A Interrupt Types

The 8259A PIC supports edge and level-triggered interrupts and fixed/rotating priority.

Signup and view all the flashcards

Interrupt Request Lines

Lines (IR7-0) are raised high, setting corresponding IRR bits.

Signup and view all the flashcards

8259's role

8259 evaluates interrupt requests then sends INT to CPU if appropriate.

Signup and view all the flashcards

INTA pulse

CPU responds to INT with INTA pulse; highest priority ISR bit is set, IRR bit reset.

Signup and view all the flashcards

8-bit pointer

8259A releases an 8-bit pointer onto the Data Bus for the CPU.

Signup and view all the flashcards

Configuring 8259

The process of configuring the 8259 with command words.

Signup and view all the flashcards

Command Word Transmission

Command words that come over the data bus from the processor, with WR' and CS' signals active.

Signup and view all the flashcards

ICW and OCW

Initialization command words (ICWs), operation command words (OCWs).

Signup and view all the flashcards

Initialization sequence

Each 8259A must be brought to a starting point using a sequence of 2-4 bytes.

Signup and view all the flashcards

Initialization Command Word 1

With A0 = 0 and D4 = 1, a command is interpreted as Initialization Command Word 1.

Signup and view all the flashcards

Interrupt type assignments

Interrupt type (IRQ number) assignment during initialization.

Signup and view all the flashcards

Meaning of bit value 1

A0 A bit value 1 indicates the IR input is connected to a slave 8259.

Signup and view all the flashcards

ICW4 presence significance

Data regarding if ICW4 is needed for initialization.

Signup and view all the flashcards

Applicability of ICW4

ICW4 usage is only if IC4 bit is set in ICW1, always present for 8086.

Signup and view all the flashcards

Ready for interrupt requests

After the ICWs are programmed, the 8259A is ready to accept interrupt requests.

Signup and view all the flashcards

Operation Command Words

A selection of command the 8259A to operate in various modes.

Signup and view all the flashcards

What does OCW1 do?

OCW1 sets and clears the mask bits in the interrupt Mask Register (IMR).

Signup and view all the flashcards

Mask bits

Eight mask bits.

Signup and view all the flashcards

M = 1

Channel is masked (inhibited).

Signup and view all the flashcards

Fully Nested Mode

Default 8259 operating mode.

Signup and view all the flashcards

Priority order

Interrupt requests ordered in priority from 0 through 7 (0 is highest).

Signup and view all the flashcards

How 8259 detects end of interrupt

8259 detects end of interrupt depending on AEOI bit setting in ICW4.

Signup and view all the flashcards

If AEOI is set:

Rising edge of ISR treated as EOI.

Signup and view all the flashcards

If AEOI is not set:

To indicate the end of an interrupt.

Signup and view all the flashcards

Complete interrupt

When the processor issues an EOI command to notify it is complete.

Signup and view all the flashcards

What is cleared upon EOI?

Clears the ISR bit corresponding to the highest priority interrupt.

Signup and view all the flashcards

Processor specification

Specify the interrupt for which it is issuing command.

Signup and view all the flashcards

Automated Rotation

Rotates priority after servicing an interrupt.

Signup and view all the flashcards

Changing lowest priority

Sets interrupt with lowest priority.

Signup and view all the flashcards

Mask bit action

It inhibits further other interrupts at that level and enables interrupts from all other levels that are not masked.

Signup and view all the flashcards

Poll 8259

The processor polls 8259.

Signup and view all the flashcards

What is the first step in doing polled command?

OCW3 is written with poll the command with the P bit set.

Signup and view all the flashcards

What is Frozen?

The ISR register is internally frozen (OCW3 write) and status reading.

Signup and view all the flashcards

Study Notes

Multiple Peripheral Interrupts

  • Most computers have multiple peripherals, but the processor has a single INTR signal.
  • ORing interrupt signals from peripherals can solve a single-issue but the problem is with the interrupt type, specifically the IRQ number, during the interrupt ACK cycle.
  • If multiple peripherals drive the data bus with the IRQ number at the same time this can be disastrous.
  • The IRQ number for peripherals should be somewhat dynamic.
  • There should be a provision to decide IRQ numbers at hardware/software system design time, or run-time.
  • A smart bridge should sit between the processor and peripherals, concatenating the interrupts and handling the IRQ.
  • Programmable Interrupt Controllers (PICs) implement this as standard.
  • The Intel 8259 PIC was popular on 8086-based systems.

8259A PIC

  • The processor views the 8259 as an I/O peripheral.
  • It comes in a 28-bit DIP or PLCC package with a 5V supply
  • An 8259 requires no separate clock for operation.
  • it can accept 8 interrupts natively.
  • Through cascading, it supports up to 64 interrupts to the processor.
  • It supports both edge and level triggered interrupts.
  • The 8259 supports fixed and rotating priority.
  • CS' (Chip Select), -WR' (Write), and -RD' (Read) are the control signals for chip selection
  • RD' and WR'.
  • An 8-bit data bus connects to the processor data bus.
  • The Interrupt (INT) pin connects to the Interrupt Request pin of the processor.
  • -INTA' ('Interrupt Acknowledge') connect to the INTA pin of the processor.
  • One address pin connects to the processor address bus, usually A1 for 8086.
  • Eight interrupt signals from peripherals connect to IR0-IR7

Basic Sequence of Operation (with 8086)

  • One or more INTERRUPT REQUEST lines (IR7-0) are raised high, setting the corresponding IRR bit(s).
  • The 8259 evaluates the requests and sends an INT to the CPU, if appropriate.
  • The CPU acknowledges the INT and responds with an INTA pulse.
  • Upon receiving an INTA from the CPU, the highest priority ISR bit is set, and the corresponding IRR bit is reset.
  • 8086 initiates a second INTA pulse during which the 8259A releases an 8-bit pointer onto the Data Bus; the CPU reads this, completing the interrupt cycle.
  • The ISR bit may reset at the end of the second INTA pulse, depending on the mode of operation.

Programming 8259A

  • 8259 needs configuration from the processor via software for operation using command words that get latched inside the 8259.
  • The command words come over the data bus from the processor. WR' and CS' signals should be active.
  • There are two types of command words: Initialization Command Words (ICWs) and Operation Command Words (OCWs).

Initialization Command Words (ICWs)

  • Before normal operation, each 8259A must be brought to a starting point using a sequence of 2 to 4 bytes.
  • Commands are written in a predefined sequence. With a single address line, the 8259 can store multiple command words in internal registers.
  • When a command is issued with A0 = 0 and D4 = 1, it will be interpreted as Initialization Command Word 1 (ICW1).
  • Initialization is usually only done once, but the 8259 can be re-initialized any time by reissuing an ICW1.
  • ICW1 configures settings such as whether ICW4 is needed, the trigger mode and if a single or cascade mode is needed
  • ICW2 is used to specify the interrupt type (IRQ number)
  • ICW3 is applicable only in cascaded mode and states whether in a cascade mode or not, configured by ICW1
  • ICW4 is only applicable if the IC4 bit is set in ICW1 and should always be present for 8086

Operation Command Words (OCWs)

  • After programming the Initialization Command Words (ICWs) into the 8259A, it is ready for interrupt requests
  • During 8259A operation, algorithms can command the 8259A to operate in various modes through the use of Operational Command Words (OCWs).
  • there are 3 OCWs.

OCW1

  • OCW1 sets and clears the mask bits in the Interrupt Mask Register (IMR), where M7 to M0 represent the eight mask bits.
  • M = 1 indicates the channel is masked or inhibited, while M = 0 indicates the channel is enabled.

Fully Nested Mode of Operation

  • This is the default 8259 operating mode and enters this mode automatically after initialization.
  • Interrupt requests are ordered in priority from 0 through 7, with 0 being the highest priority.
  • When one or more Interrupt Request (IR) signals go high, corresponding bits in the Interrupt Request Register (IRR) become high.
  • The priority resolver checks for any unmasked interrupt bit in IRR. If bits are set whose priority level is higher than the currently serviced interrupt, the INTR signal to the processor goes high.
  • During the first INTA', the state of IRR is frozen. The priority resolver chooses the highest unmasked interrupt and makes the corresponding ISR bit high.
  • When the processor issues the second INTA', the IRQ number (type) corresponding to the SET ISR is placed on the data bus.
  • This completes the interrupt cycle.

End of Interrupt

  • An end of interrupt is detected when a corresponding bit in the In-Service Register (ISR) is cleared.
  • How the 8259 detects an end of interrupt depends on the Automatic End Of Interrupt (AEOI) bit setting in ICW4.
  • If the AEOI bit is set, the rising edge of the second INTA' signal is treated as the end of the interrupt, and the ISR bit is cleared.
  • If 8259 is configured in fully nested mode with AEOI, no more than one bit will be set in the ISR at any given time.
  • If the AEOI bit is not set, 8086 must write a command to 8259 to indicate the end of an interrupt.
  • The command can be issued using an OCW2.
  • When a non-specific EOI command is issued, the ISR bit corresponding to the highest priority interrupt is cleared.
  • Alternatively, the processor can use a specific EOI in order to specify the interrupt to clear.

Automatic Rotation Mode

  • In some applications, there are multiple interrupting devices of equal priority.
  • In this mode, a device, after being serviced, receives the lowest priority.
  • A device requesting an interrupt will have to wait, in the worst case, until each of 7 other devices is serviced at most once.
  • This mode is also set using OCW2
  • Using 'Rotate on non-specific EOI' command in OCW2 rotates priorities.

Special Mask Mode

  • An 8259 automatically masks interrupts whose priority is lower than the currently serviced interrupt except in certain applications where low priority interrupts may need detecting.
  • In special Mask Mode, when a mask bit is set in OCW1, it inhibits further interrupts at that level and enables interrupts from all other levels (lower as well as higher) that are not masked.
  • This means that only interrupts which are explicitly masked in the IMR' are inhibited, and all other interrupts will be propagated to the processor.
  • Special Mask Mode is set with the help of OCW3.

Polling Mode

  • In this mode, the processor does not use the INT signal from 8259 to detect an interrupt, but polls 8259 directly.
  • In order to do this, an OCW3 is first written with the P bit set.
  • The next read after this write (RD' low CS' low) will return a pending interrupt, if one exists.
  • The IS Register is internally frozen by the poll command (OCW3 write) and status reading.
  • Also, the read operation is treated as interrupt acknowledge, and the corresponding bit in the ISR is set.
  • The INT signal from 8259 will still be asserted when there is an interrupt, but it may either be disconnected to the processor or masked by clearing Interrupt flag (IF).
  • The ISR bit is cleared using the End of Interrupt (Eol) command.
  • Polling command contains information such as whether there is a pending interrupt and a binary code of the pending interrupt with highest priority.

Reading 8259 Registers

  • In addition to interrupt status, other registers from 8259 can be read when in polling mode.
  • If OCW3 is used to configure reading the IRR, any subsequent read operations with A0 bit set to 0 will return the IRR status.
  • There is no need to write OCW3 before each IRR read.
  • 8259 remembers the last read setting.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

More Like This

Interrupts 8259 PIC and 8086 Interrupts Quiz
10 questions
Use Quizgecko on...
Browser
Browser