8259 Complete Notes
8259 Complete Notes
8259 Complete Notes
PROGRAMMABLE INTERRUPT
CONTROLLER
INTERRUPT
• An interrupt is an event which informs the CPU that its
service (action) is needed. An interrupt is a hardware-
initiated procedure that interrupts whatever program is
currently executing.
• Sources of interrupts:
– internal fault (e.g.. divide by zero, overflow)
– software
– external hardware :
• maskable
• nonmaskable
– reset
INTERRUPTS
• Intel processors include two hardware pins (INTR and
NMI) that request interrupts.
• And one hardware pin (INTA) to acknowledge the
interrupt requested through INTR.
• The processor also has software interrupts INT, INTO,
INT 3, and BOUND.
• Flag bits IF (interrupt flag) and TF (trap flag), are also
used with the interrupt structure and special return
instruction IRET
– IRETD in the 80386, 80486, or Pentium
BASIC PROCEDURE FOR PROCESSING
INTERRUPTS
• When an interrupt is executed, the mp:
– finishes executing its current instruction (if any).
– saves (PUSH) the flag register, IP and CS register in
the stack.
– goes to a fixed memory location.
– reads the address of the associated ISR.
– Jumps to that address and executes the ISR.
– gets (PULL) the flag register, CS:IP register from the
stack.
– continues executing the previous job (if any).
PIN DIAGRAM
PIN DESCRIPTION (contd.)
• The interrupts at the IR input
lines are handled by two
LOGIC DIAGRAM registers in cascade, the IRR and
ISR.
• IRR indicates all interrupt levels
which are requesting service,
and the ISR stores all interrupt
levels which are currently being
serviced.
• PR determines the priorities of
the bits set in lRR. The highest
priority is selected and strobed
into the corresponding bit of the
lSR during the INTA sequence.
• lMR stores the bits which disable
the interrupt lines to be masked.
It operates on the output of the
IRR.
• Masking of a higher priority
input will not affect the interrupt
request lines of lower priority.
FEATURES
ICW3 If it is initialised
as a master, (the SP/EN
(bar) pin is high in non-
buffered environment or
M/S(bar)=1 in ICW4 in
buffered environment)
each bit in ICE3 is used to
specify to the master
whether it has a slave
8259 attached to its
corresponding IR pin.
PROGRAMMING THE 8259 (contd.)
ICW3 If it is initialised
as a slave, (the SP/EN
(bar) pin is low in non-
buffered environment or
M/S(bar)=0 in ICW4 in
buffered environment)
bits D0 – D2 of ICW3 are
used to assign a slave
identification code (slave
ID) to the 8259. the slave
ID is equivalent to the
master IR input to which
the INTR output of the
slave is connected.
PROGRAMMING THE 8259 (contd.)
ICW4
INITIALIZATION PROCEDURE
OPERATIONAL COMMAND WORDS
OCW1
OCW2
OPERATIONAL COMMAND WORDS
(contd.)
OPERATIONAL COMMAND WORDS
(contd.)
OPERATIONAL COMMAND WORDS
(contd)
• OCW3
OPERATIONAL COMMAND WORDS
(contd)
BUF
• This is used to indicate to the 8259 whether it is
in buffered or non-buffered mode. If BUF=1, the
SP/EN (bar) pin is used as an output to enable
the data bus buffer of the system.
M/S(bar)
• In the buffered mode, this pin when 1 and sets
up the 8259 to be initialized as a master and
when 0, sets up as a slave.
MODES