Programmable Interrupt Controller (PIC) - 8259
Programmable Interrupt Controller (PIC) - 8259
Programmable Interrupt Controller (PIC) - 8259
(PIC) - 8259
Programmable Interrupt Controller (PIC)
• 8259 is Programmable Interrupt Controller (PIC)
• It manage 8-interrupts according to the instructions written into its control registers.
• In 8086 processor, it supplies the type number of the interrupt and the type number is
programmable.
FUNCTIONAL BLOCK DIAGRAM OF 8259: It has eight functional blocks. They are:
• Control logic
• Read Write logic
• Data bus buffer
• Interrupt Request Register (IRR)
• In-Service Register (ISR)
• Interrupt Mask Register (IMR)
• Priority Resolver (PR)
• Cascade buffer.
Architecture of PIC-8259
Data Bus Buffer:
Data bus and its buffer are used for the following activities:
• It is a tristate bidirectional buffer interfaces internal
8259A to the microprocessor system data bus
• From the data bus buffer the 8259 send type number
through D0-D7 to the processor.
• Normally IR0 has highest priority and IR7 has the lowest priority. The priorities of the
interrupt request input are also programmable.
• First the 8259 should be programmed by sending Initialization Command Word (ICW) and
Operational Command Word (OCW). These command words will inform 8259 about the
following:
In-service register(ISR):
• The in-service register keeps track of which interrupt is
currently being serviced.
Priority resolver:
• The priority resolver examines the interrupt request,
mask and in-service registers and determines whether
INT signal should be sent to the processor or not.
• The IR0 has the highest priority while the IR7 has the
lowest priority, normally in fixed priority mode.
WR (WRITE):
• A LOW on this input enables the CPU to write control words
(ICWs and OCWs) to the 8259A.
RD (READ) :
• A LOW on this input enables the 8259A to send the status of the
Interrupt Request Register (IRR), In Service Register (ISR), the
Interrupt Mask Register (IMR), or the Interrupt level onto the
Data Bus.
A0:
• This input signal is used in conjunction with WR and RD signals to
write commands into the various command registers, as well as
reading the various status registers of the chip. This line can be
tied directly to one of the address lines.
Pin description
D7 - D0: BIDIRECTIONAL DATA BUS- Control, status and
interrupt-vector information is transferred via this bus.
1. One or more of the INTERRUPT REQUEST lines (IR7 – IR0) are raised high, setting the
corresponding IRR bit(s).
2. The 8259A evaluates these requests, and sends an INT to the CPU, if appropriate.
3. The CPU acknowledges the INT and responds with an INTA pulse.
4. Upon receiving an INTA from the CPU group, the highest priority ISR bit is set, and the
corresponding IRR bit is reset. The 8259A will also release a CALL instruction code
(11001101) onto the 8-bit Data Bus through its D7 - D0 pins.
5. This CALL instruction will initiate second INTA pulses to be sent to the 8259A from the
CPU group.
6. This INTA pulse allow the 8259A to release an 8-bit preprogrammed subroutine address
onto the Data Bus.
7. ISR bit is reset at the end of the 2nd INTA pulse if automatic EOI mode is programmed
8255- Programmable Peripheral Interface
Hand shaking
• Many I/O devices accept or release information
slower than the microprocessor.
• A method of I/O control called handshaking or
polling, synchronizes the I/O device with the
microprocessor.
• An example is a parallel printer that prints a few
hundred characters per second (CPS).
• The processor can send data much faster.
– a way to slow the microprocessor down to match
speeds with the printer must be developed
13
Hand shaking
• I/O synchronization is achieved by
implementing what is known as handshaking as
part of the input/output interface.
• It is flexible, versatile and economical (when multiple I/O ports are required).
• It is an important general purpose I/O device that can be used with almost
any microprocessor.
8255- Programmable Peripheral Interface
8255- Programmable Peripheral Interface
• This 8255 has 24 input/output lines, which can be
individually programmed.
PC7 – PC4 :- These are four Port C upper lines that can act as input or
output lines. This port can be used for the generation of handshake
lines.
PC3 – PCo : - These are four port C lower lines that can act as input or
output lines. This port can also be used for the generation of
handshake lines.
PB0 – PB7 :- These are 8 port B lines which can be input or output lines
in the same way as port A
D0 – D7 :- These are the data bus lines that carry data or control word
to/from the microprocessor.
This 8255 is a widely used, flexible and economical I/O device that can
be used with almost all microprocessors when multiple I/O ports
are required. 8255 is a 40 pin IC.
MODES OF OPERATION OF 8255
• All the functions of 8255 A is classified according to two modes: the Bit
Set/Reset (BSR) mode and the I/O mode.
– The I/O mode is further divided into three modes: Mode 0, Mode 1 and Mode 2.
– Mode 1 is a handshake mode whereby port A and port B use bits from port C as
handshake signals.
– In the handshake mode, two types of I/O data transfer can be implemented: status
checks and interrupt.
– In Mode 2 port A can be set up for bidirectional data transfer using handshaking
signals from port C and port B can be set up either in Mode 0 or Mode 1.
Mode 0 : Simple Input or Output
• This is also called basic I/O mode. In this mode, ports A and B are used as
two simple 8-bit I/O ports and port C as two 4-bit ports.
– Two ports (A and B) function as 8-bit I/O ports. They can be configured either
as input or output ports.
– Each port uses three lines from port C as handshake signals. The remaining
two lines of port C can be used for simple I/O functions.
– Input and output data are latched.
– Interrupt logic is supported.
• In the 8255, the specific lines from port C used for handshake signals
vary according to the I/O function of a port.
Mode 2: Bidirectional Data Transfer
• This is also called strobe bi-directional I/O mode.
• Port A uses five signals from port C as handshake signals for data
transfer.
• The remaining three signals from port C can be used as simple I/O
or as handshake for port B.