Interrupt
Interrupt
RAM ROM
INTR
INT
Interrupt
io1 io7
MPU Controller
INTA# IR0
IR7 ...
reset NMI
8259 Programmable Interrupt
Controller (PIC)
• The 8259 PIC functions as overall mgr of an interrupt
system environment.
• Each PIC has up to 8 interrupt request (IR) inputs
• Expandable up to 64 interrupt levels via cascading in a
Primary Secondary environment.
• Some Internal Registers are
– Interrupt Req. Reg (IRR): 8b reg storing 8 independent IRQs
– In-Service Reg (SR): 8b reg storing interrupt levels which are
being serviced
– Interrupt Mask Reg (IMR): 8b reg storing interrupt levels to be
masked. It operates on IRRs.
PIC Details
T7 T6 T5 T4 T3 T2 T1 T0
• Separate ICW3 format for Pri and Sec. Master icw3 format follows
b7 b6 b5 b4 b3 b2 b1 bo
S7 S6 S5 S4 S3 S2 S1 S0
b7 b6 b5 b4 b3 b2 b1 bo
0 0 0 0 0 d2 d1 d0
D2D1D0= ID# of Pri’s IR input Sec is connected to. =000 => slave ID
=0, …, =111 => slave ID = 7.
PIC Configuration in typical PC
Port 20h
Vector in icw2
=08h Vec 08h SP#/EN#
= Vcc=1
IRQ0 IR0 INT INTR
IRQ1 IR1
IR2 Pri PIC MPU
IRQ3 . IR3
IRQ7 . INTA#
IR7
Port A0h
CAS0-2
Vec 70h
IRQ8 IR0
INT
IRQ9 IR1
. CAS0-2
Sec PIC LOGIC
. INTA#
IRQ15 IR7
SP#/EN# = 0
Examples
• In current PCs, • There is a single
– edge triggered inputs secondary connected
– 2 cascaded PICs to the Primary’s IR2
– ICW4 needed • Primary’s ICW3 =
• ICW1=00010001=11h 00000100=04h
mov al, 11h • Secondary’s ICW3=
out 20h, al 00000010=02h
ICW4
b7 b6 b5 b4 b3 b2 b1 bo
1=Special Fully
Nested Mode 0 X = nonbuffered
Note: There is
1 0 = buff mode sec a separate
ICW4 for Pri
1 1 = buff mode pri
and Sec using
the same
1=Auto EOI format
0=Manual EOI
M7 M6 M5 M4 M3 M2 M1 M0
Format Follows :
b7 b6 b5 b4 b3 b2 b1 bo
R SL EOI 0 0 L2 L1 L0
Rotation
000 = Level 0
Specific Level
001 = Level 1
End-Of-Interrupt ...
111 = Level 7
OCW2 DETAILS
R SL EOI Description
0 0 1 Non specific EOI cmd
0 1 1 *Specific EOI cmd
1 0 1 Rotate on Nonspec EOI cmd
1 0 0 Rotate in Auto EOI mode(set)
0 0 0 Rotate in Auto EOI mode(clr)
1 1 1 *Rotate on Specific EOI cmd
1 1 0 *Set Priority cmd
0 1 0 No Operation
*: L2L1L0 are used
OCW3
b7 b6 b5 b4 b3 b2 b1 bo
b7 b6 b5 b4 b3 b2 b1 bo
I 0 1 W2 W1 W0
Note: Poll Word is issued by PIC in response to Poll from MPU via
OCW3