8255 (PPI) Programmable Peripheral Interface YASH PAL, April 1, 2026April 1, 2026 8255 Programmable Peripheral Interface – The 8255 (PPI) is a programmable, parallel input/output device. It can be programmed to transfer data under different conditions, from simple input/output. It is flexible, versatile, and economical (when multiple input/output ports are required), but somewhat complex. It is widely used with almost any microprocessor.The 8255 Programmable Peripheral Interface has 40 pins; out of these, 24 input/output pins can be grouped in 8-bit parallel ports: Port A and Port B, with the remaining eight bits as Port C. Port C can be used as an individual or be grouped in two 4-bit ports, namely, port CUPPOER (CU) and port CLOWER (CL) as shown in figure below. The function of these ports is defined by writing a control word in the control register.8255 input/output portsBlock Diagram of the 8255 InterfaceThe block diagram is shown in the figure below, with various elements and their functions as follows:Block diagram of 8255pin configuration of 8255Pin NamePin FunctionD7 – D0Data Bus (Bidirectional)RESETReset InputCSChip SelectRDRead InputWRWrite InputA0, A1Port AddressPA7 – PA0Port A (Bit)PC7 – PC0Port B (Bit)Vcc+5 VoltsGND0 VoltsParallel PortsPort A: Contains 8 pins (PA0 – PA7) for receiving/sending data, it is used as an 8-bit parallel port.Port B: Also used as an 8-bit parallel port. It contains 8 pins (PB0 – PB7) for receiving/sending data.Port C: Used as an 8-bit parallel port. It can be divided into two 4-bit ports: CUPPER (CU) and CLOWER (CL). It contains 8 pins (PC0 – PC7) for receiving/sending data. Port C pins can also be used for handshake signals.Control LogicThe control section has six lines. Their functions are as follows:RD (Read): This control signal enables the read operation. This is an active low signal. When it goes low, the microprocessor reads data from a selected input/output port of the 8255.WR (Write): This control signal enables the write operation. This is also an active low signal. When it goes low, the microprocessor writes into a selected input/output port or the control register.RESET (Reset): It clears the control register and sets all ports in the input mode. It is an active high signal.Address LogicA0, A1: These pins are generally connected to microprocessor address lines – A0 and A1. The combination of these two is used to identify the address of various ports and the control register. For this purpose, an internal decoder is used.Control logic diagram of 8255CS (Chip Select): It is the master chip select signal. It is an active low signal. When it goes low, the chip will be selected. Address lines other than A0 and A1 may be used in any combination to make the chip select logic. Addresses of ports and control registers can be determined by a combination of CS, A1, and A0 lines. This is shown in the table below and in the above figure.CSA1A0Port Selected000Port A001Port B010Port C011Control Register1XX8255 not selectedAddress decoding of 8255Control RegisterThe register, which is internal to the 8255 chip, is called the control register. The contents of this register are known as the control word. The control word specifies the input/output function and modes of various ports of the 8255. The control register can be accessed to write a control word when both A0 and A1 are high, as shown in the table above.Interfacing Steps in 8255To communicate with peripherals through the 8255, three steps are necessary.Determine the address of ports A, B, and C and of the control register by the use of the chip select logic and address lines A0 and A1.Determine the control word and write it into the control register.Write input/output instructions to communicate with the peripheral through ports A, B, and C.Note: The control register can’t be used for the reading operation.Modes of 8255All the functions of 8255 are classified according to two modes.BSR (bit set/reset) ModeInput/Output ModeThe modes of 8255 are shown in the figure below.modes of 8255BSR (Bit Set/Reset) ModeThe BSR mode includes only eight bits of port C, which can be set or reset by writing the suitable control word in the control register. In BSR mode, the D7 bit of the control word is at logic 0, and it does not affect the previously transmitted control word with bit D7 = 1; this indicates that input/output operations of ports A and B are not altered by a BSR control word.BSR Control Word: BSR control word sets or resets one bit at a time of port C. When written in the control register. The control word format for this mode is shown in the figure below.BSR control word formatInput/Output Mode in 8255Input/output mode is used to transfer the data to or from the peripherals. The D7 bit of the control word must be set (1) for this mode. Three different types of input/output modes are available in the 8255.Mode 0 – Simple input/output modeMode 1 – Input/output with handshake signalsMode 2 – Bidirectional modeControl word format – The control word format is shown in the figure below.8255 control word format for input/output modeMode 0 – Simple input/output modeIn this mode, Ports A and B are used as two simple 8-bit Input/Output ports and Port C as two 4-bit ports. Each port (or half-port in the case of port C) can be programmed to function as simply an input port or an output port.Mode 1 – Input/output mode with handshakeIn this mode, input or output data transfer is controlled by handshake signals. Handshake signals are used to transfer data between devices whose data transfer speeds are not the same. The handshaking signals are used to inform the microprocessor whether the peripheral is ready to communicate or not. In mode 1, handshake signals are exchanged between the microprocessor and peripherals prior to the data transfer. The features of this mode include the following:Port A and Port B function as 8-bit input/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 input/output functions.In the 8255, the specific lines from port C are used for handshake signals. These lines are very similar to the input/output function of a port. Therefore, input and output functions in mode 1 are discussed separately.Mode 1: Input Control SignalsWhen both port A and port B are configured as input ports, and port C is used for handshake signals. Port A uses the upper three lines of port C, PC3, PC4, and PC5, whereas port B uses the lower three lines: PC0, PC1, and PC2. The functions of these signals are as follows:STB (Strobe input): This is an active low input signal generated by a peripheral device to indicate that it has transmitted a byte of data. In response to STB, the 8255 generates IBF and INTR signals as shown in the figure below.IBF (Input Buffer Full): This is an active high output signal. This signal is an acknowledgement by the 8255 to indicate that the input latch has received the data byte. This is reset when the microprocessor has read the data.INTR (Interrupt Request): This is an active high output signal that may be used to interrupt the microprocessor. This signal is generated if STB, IBF, and INTE (Internal Flip-flop) are all at logic 1. This is reset by the falling edge of the RD signal.INTE (Interrupt Enable): This is an internal flip-flop used to enable or disable the generation of the INTR signal.8255 mod 1 input configurationThe two flip-flops INTEA and INTEB are set/reset using the BSR mode. The INTEA is enabled or disabled through PC4, and INTEB is enabled or disabled through PC2. The timing waveform for the strobed input (with handshake) is shown in the figure below.8255 Mode 1 – Timing Waveforms for strobed input (with Handshake)Control Word – To configure port A and port B as input ports in mode 1, the control word, according to the format shown in the above figure “8255 Control Word format for input/output mode“, will be as follows:D7D6D5D4D3D2D1D010111/011XI/O modePort A = Mode 1Port A = Mode 1Port A = Input PortPC6, PC71 = Input0 = OutputPort B = Mode 1Port B = Input PortDon’t CareStatus Word – When we read port C in mode 1, the bit pattern loaded into the Accumulator is called the status word. The status word for mode 1, when both port A and port B are configured as input ports, is as follows:D7D6D5D4D3D2D1D0I/OI/OIBFAINTEAINTRAINTEBIBFAINTRBMode 1: Output Control SignalsWhen both port A and port B are configured as output ports, port C is used for handshake signals. The functions of various output control signals are as follows:OBF (Output Buffer Full): This is an output signal that goes low when the microprocessor writes data into the output latch of 8255. This signal indicates to an output peripheral that new data are ready to be read; it goes high again after the 8255 receives an ACK signal from the peripheral.ACK (Acknowledge): This is an active low input signal. It is generated by the peripheral after receiving data from the output latch of 8255. When it goes low, OBF goes high again, indicating that the output buffer is empty.INTR (Interrupt Request): This is an active high output signal, which may be used to interrupt the microprocessor by connecting it to any of the interrupt pins. The INTR is set when OBF, ACK, and INTE are all at logic 1. This is reset by the falling edge of the WR.INTE (Interrupt Enable): This is an internal flip-flop, which is used to enable or disable the generation of the INTR signal. The two flip-flops INTEA and INTEB are controlled by bits PC6 and PC2, respectively, through the BSR mode.8255 mode 1 output configurationControl Word – To configure port A and port B as output ports in mode 1, the control word, according to the format shown in the above figure “8255 Control Word format for input/output mode” will be as follows:D7D6D5D4D3D2D1D010101/010XI/O modePort A = Mode 1Port A = Mode 1Port A = Output PortPC4, PC51 = Input0 = OutputPort B = Mode 1Port B = Output PortDon’t CareStatus Word – When we read port C in mode 1, the bit pattern loaded into the accumulator is called the status word. The status word for mode 1, when both port A and port B are configured as output ports, is as follows:D7D6D5D4D3D2D1D0OBFAINTEAI/OI/OINTRAINTEBOBFBINTRBThe timing waveform for the strobed output (with handshake) is shown in the figure below.8255 mode 1 timing waveform for strobed output with handshakeMode 2: Bidirectional Data TransferThis mode allows bidirectional data transfer (transmission and reception) over a single 8-bit data bus only in group A, with port A as the 8-bit bidirectional data bus; and lines PC3 – PC7 are used for handshaking purposes. Port B can be configured in mode 0 or in mode 1. If port B is configured in mode 0, the three pins (PC0, PC1, and PC2) may be used for input/output purposes as shown in the figure below.8255 mode 2 with port B in mode 0Whereas if port B is configured in mode 1, then these three pins (PC0, PC1, and PC2) will also be utilized by handshake signals for port B, as shown in the figure below.8255 mode 2 with port B in mode 1Programming the 8255 in Mode 1The 8255 can be programmed using the following two techniques:Status check Input/OutputInterrupt Input/OutputStatus check Input/OutputIn this technique, the microprocessor reads the status word from port C, checks for a particular status bit in a loop until it gets the proper status to synchronise with the slow peripheral. This is the use of handshake signals, where, before transmitting data, the status of the slower peripheral is checked. Whether it is ready or not, otherwise the data may be lost. The status check process can be explained using the following flow chart, given below.Status check input outputInterrupt Input/OutputInterrupt Input/Output assumes that vectored interrupts are available. The INTE flip-flop is set, which will generate the INTR signal. The INTR signal is connected to any of the interrupt pins (TRAP, RST 7.5, RST 6.5, RST 5.5, or INTR) of the microprocessor. A flow chart for this type of programming can be given as in the figure below.Interrupt input output engineering subjects Microprocessor microprocessor