Interrupt Controller (8259A)
ICW Summary
In summary, three or four ICWs are required to initialize the master
and each slave PIC. Specifically:
•
Master PIC - No Slaves: ICW1, ICW2, ICW4
•
Master PIC - With Slave(s): ICW1, ICW2, ICW3, ICW4
•
Each Slave PIC: ICW1, ICW2, ICW3, ICW4
To initialize the PICs (master and slave), proceed as follows:
1.
Disable system interrupts by executing a CLI (Clear Interrupt
Flag) instruction.
2.
Initialize the master PIC by writing ICWs in the following
sequence:
a)
Write ICW1 and ICW2.
b)
If slave PICs are used, write ICW3 and ICW4. If no slave
PICs are used, omit ICW3 and write ICW4 only.
3.
Initialize each slave PIC by writing ICWs in the following
sequence: ICW1, ICW2, ICW3, and ICW4.
4.
Enable system interrupts by executing an STI (Set Interrupt
Flag) instruction.
Operation Control Words (OCW1-3)
After initialization, master and slave PICs can be programmed at any
time for various operating modes. Operation Control Word (OCW)
formats are shown in Figure 12-4.
Three OCWs are available for programming various modes and
commands. Unlike ICWs, OCWs need not be in sequential order.
Rather, they are issued by the processor as needed within a program.
12-16