ICW and OCW in 8259

ICW in 8259:

ICW stands for Initialization Command Words. The 8259A has four ICWs and they are named ICW1, ICW2, ICW3, and ICW4. When only one 8259 is used in the system, we have to program 8259 by sending ICW1, ICW2, and ICW4. When a number of 8259s are used in the system then we have to program each 8259 by sending all four ICWs. The format of ICW3 for master and slave 8259 is different.

OCW in 8259:

OCW stands for Operation Command Words. The 8259 has three Operation Command Words (OCWs) and they are named OCW1, OCW2, and OCW3.

OCW1: The OCW1 is sent to 8259 to mask or unmask the IR inputs of 8259. At any time the mask status of interrupts can be read by the processor by using the same address as OCW1.

OCW2: The OCW2 is sent to 8259A only when the AEOI mode (in ICW4) is not selected. The OCW2 is sent by the processor to decide on the type of End-of-Interrupt (EOI) and to program the priorities of the interrupt.

OCW3: The OCW3 is used to set special mask mode, poll the active interrupt request and read the in-service and interrupt request registers. In special mask mode, the mask status is negated to allow the interrupts masked by the interrupt mask register.