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.

ICW1: The IC4 bit is set to one if we decide to send ICW4. The single or cascade mode of operation is selected by programming the “SNGL” bit. The LTIM bit determines whether the interrupt request input is positive edge-triggered or level-triggered. The bit ADI is used to program a call address interval of 4 or 8 in the case of the 8085 system. The upper three bits (D5, D6, and D7) of ICW1 are used to program the upper three bits of the low byte of the call address. The lower five bits of the low byte of the call address are automatically inserted by 8259.

ICW and OCW in 8259

ICW2: This command word is used to program the high byte of the call address.

ICW and OCW in 8259

ICW3: The ICW3 should be sent to 8259s in cascade operation. Separate formats are provided for master and slave 8259s. In cascade mode, slave 8259s are connected to one or more IR inputs of master 8259, and each slave is provided with a slave ID number. The connection of slave 8259s to the IR inputs of the master is informed to the master through ICW3. For slave 8259s, the ID numbers are informed through ICW3.

ICW and OCW in 8259

ICW4: The ICW4 is used to inform 8259 whether it is connected to the 8085 or 8086-based systems. For the 8085-based system, the rightmost bit is programmed as zero. The AEOI bit is used to program the method of terminating the interrupt.

ICW and OCW in 8259

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.

ICW and OCW in 8259

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.

ICW and OCW in 8259

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.

ICW and OCW in 8259