8259 Block Diagram - Modes
8259 Block Diagram - Modes
Fig. 14.71 shows the internal 8259 Block Diagram. It includes eight blocks : data
bus buffer, read/write logic, control logic, three registers (IRR, ISR and IMR),
priority resolver, and cascade buffer.
The data bus buffer allows the 8085 to send control words to the 8259A and read a
status word from the 8259 Block Diagram. The 8-bit data bus buffer also allows the
8259A to send interrupt opcode and address of the interrupt service subroutine to the
8085.
Read/Write Logic:
The RD and WR inputs control the data flow on the data bus when the device is
selected by asserting its chip select (CS) input low.
Control Logic:
This block has an input and an output line. If the 8259A is properly enabled, the
interrupt request will cause the 8259A to assert its INT output pin high. If this pin is
connected to the INTR pin of an 8085 and if the 8085 Interrupt Enable (IE) flag is
set, then this high signal will cause the 8085 to respond INTR as explained earlier.
Interrupt Request Register (IRR):
The IRR is used to store all the interrupt levels which are requesting the service. The
eight interrupt inputs set corresponding bits of the Interrupt Request Register upon
service request.
Interrupt Service Register (ISR):
The Interrupt Service Register (ISR) stores all the levels that are currently being
serviced.
Interrupt Mask Register (IMR):
Interrupt Mask Register (IMR) stores the masking bits of the interrupt lines to be
masked. This register can be programmed by an Operation Command Word (OCW).
An interrupt which is masked by software will not be recognised and serviced even
if it sets the corresponding bits in the IRR.
Priority Resolver:
The priority resolver determines the priorities of the bits set in the IRR. The bit
corresponding to the highest priority interrupt input is set in the ISR during the INTA
input.
Cascade Buffer Comparator:
This section generates control signals necessary for cascade operations. It also
generates Buffer-Enable signals. As stated earlier, the 8259 Block Diagram can be
cascaded with other 8259s in order to expand the interrupt handling capacity to sixty-
four levels. In such a case, the former is called a master, and the latter are
called slaves. The 8259 can be set up as a master or a slave by the SP/EN pin.
CAS0— CAS2
For a master 8259, the CAS0-CAS2 pins are output pins, and for slave 8259, these
are input pins. When the 8259 is a master (that is, when it accepts interrupt requests
from other 8259s), the CALL opcode is generated by the Master in response to the
first INTA. The vector address must be released by the slave 8259. The master sends
an identification code of three-bits to select one out of the eight possible slave 8259s
on the CAS0-CAS2 lines. The slave 8259s accept these three signals as inputs (on
their CAS0 – CAS2 pins) and compare the code sent by the master with the codes
assigned to them during initialization. The slave thus selected (which had originally
placed an interrupt request to the master 8259) then puts the address of the interrupt
service routine during the second and third INTA pulses from the CPU.
SP / EN (Slave Program /Enable Buffer):
The SP/EN signal is tied high for the master. However it is grounded for the slave.
In large systems where buffers are used to drive the data bus, the data sent by the
8259 in response to INTA cannot be accessed by the CPU (due to the data bus buffer
being disabled). If an 8259 is used in the buffered mode (buffered or non-buffered
modes of operation can be specified at the time of initializing the 8259), the SP/EN
pin is used as an output which can be used to enable the system data bus buffer
whenever the data bus outputs of 8259 are enabled (i.e. when it is ready to send data).
Thus, in non-buffered mode, the SP/EN pin of an 8259 is used to specify whether
the 8259 is to operate as a master or as a slave, and in the buffered mode, the SP/EN
pin is used as an output to enable the data bus buffer of the system.
Interrupt Sequence:
After initialization, the 8259A operates in fully nested mode so it is called default
mode. The 8259 continues to operate in the Fully Nested Mode until the mode is
changed through Operation Command Words. In this mode, IR0 has highest priority
and IR7 has lowest priority. When the interrupt is acknowledged, it sets the
corresponding bit in ISR. This bit will inhibit all interrupts of the same or lower
level, however it will accept higher priority interrupt requests. The vector address
corresponding to this interrupt is then sent. The bit in the ISR will remain set until
an EOI command is issued by the microprocessor at the end of interrupt service
routine. But if AEOI (Automatic End Of Interrupt) bit is set, the bit in the ISR resets
at the trailing edge of the last INTA .
End of Interrupt (EOI):
If the AEOI mode is set, the 8259 Block Diagram will perform a non-specific EOI
on its own on the trailing edge of The third INTA pulse. The AEOI mode can only
be used for a master 8259 and not for a slave.
The Special Fully Nested Mode (SFNM) is used to avoid this problem. The SFNM
is set up by ICW4 during initialisation. It is similar to the FNM except for the
following differences:
The Rotating Priority mode can be set in (i) Automatic Rotation, and (ii) Specific
Rotation.
i) Automatic Rotation:
In this mode, a device, after being serviced, receives the lowest priority. The device
just been serviced, will receive the seventh priority. Here IR3 has just been serviced.
ii)Specific Rotation:
In the Automatic Rotation mode, the interrupt request last serviced is assigned the
lowest priority, whereas in the Specific Rotation mode, the lowest priority can be
assigned to any interrupt input (IR0 to IR7) thus fixes all other priorities.
For example if the lowest priority is assigned to IR2, other priorities are as shown
below.
4. Special Mask Mode in 8259:
If any interrupt is in service, then the corresponding bit is set in ISR and the lower
priority interrupts are inhibited. Some applications may require an interrupt service
routine to dynamically alter the system priority structure during its execution under
software control. For example, the routine may wish to inhibit lower priority requests
for a portion of its execution but enable some of them for another portion. In these
cases, we have to go for special mask mode. In the special mask mode it inhibits
further interrupts at that level and enables interrupts from all other levels (lower as
well as higher) that are not masked. Thus any interrupt may be selectively enabled
by loading the mask register.
In this mode the INT output is not used. The microprocessor checks the status of
interrupt requests by issuing poll command. The microprocessor reads contents of
8259A after issuing poll command. During this read operation the 8259A provides
polled word and sets ISR bit of highest priority active interrupt request FORMAT.