Goseeko blog

What is 8255 (programmable peripheral interfaces)?

by Sonali

·  The 8255 microprocessor is also known as Programmable Peripheral Interface. It is a multi port device.

·   There are 24 I/O pins in this microprocessor. There are three 8 bit ports are PA, PB, PC. There is 8 bit I/O ports are PORT A and PORT B. 

·   The Port C is used as an 8-bit I/O port or as two 4-bit I/O ports or produces handshake signals for ports A and B.

·   CS: The chip select CS (pin 6) is used to enable the 8255 chip.  It is an active-low signal, hence is enabled when CS = 0.

·   RESET:  This pin number 35 which is connected to 8085 RESET line. When the system is reset, all the ports behave as input lines. This is done to prevent 8255 from being destroyed due to mismatch of ports.

·   Data lines D0-D7 are used to read/write data into the control register or the ports. This can be done by using the pin RD and WR. This is achieved with the active low signals on both RD and WR pins. 

·   Address lines A1 and A0 allow to access a data register for each port or a control register, as listed below:

A1A0PORT SELECTED
00PORT A
01PORT B
10PORT C
11Control Register

Operating Modes

The two operating modes of Programmable peripheral interface are:

o   Bit set/reset mode (BSR mode)

o   Input/ output mode 

The modes selected by the D7 bit of the control word register are:

When D7 = 1, 8255 operates in I/O mode and BSR mode.

BSR MODE

The port C has Bit Set/Reset (BSR) mode. By providing proper values to the CWR we can set or reset each and every line of port C (PC7 – PC0). BSR mode is independent and its selection does not affect the operation of other ports in I/O mode.

A Control Word Format in BSR Mode | Download Scientific Diagram

·  D7 bit remains 0 for this mode.

·  The don’t care bits are D6, D5 and D4.

·  Port C pin selection is done through bits D3, D2 and D1 

·  The above selected pin can be set/reset using D0 

Selection of port C pin is determined as follows:

For example:

If PC4 be set, then in the control word is,

·  As we know for BSR mode the bit D7 = ‘0’.

·  Since, we know that the bits D4, D5, D6 don’t care, we assume them to be ‘0′.

·  The bits D3 = ‘1’, D2 = ‘0’, D1 = ‘0’ because PC4 has to be selected,

·  The value of bit  D0 = ‘1’ because PC4 is set.

Therefore, the control word register will have the value 0AH as per above values.

I/O MODE

When the D7 bit of the Control Word Register is 1, this mode is selected.

There are three I/O modes and they are:

o  Mode 0 – Simple I/O

o  Mode 1 – Strobed I/O

o  Mode 2 – Strobed Bi-directional I/O

Mode 0 (Simple or basic I/O mode):

Port A, B and C can work either as input or as output function. The outputs are latched but the inputs are not latched. It can also handle interrupts.

Mode 1 (Handshake or strobed I/O):

Here, either port A or B can work and port C is used to provide handshake signals. The outputs as well as inputs are latched.  It can also handle interrupts. In order to match the speed of the CPU and printer a signal is transmitted before actual data is transmitted

Mode 2 (Bidirectional I/O):

In this mode only port A will work, port B can either be in mode 0 or 1 and port C bits are used as handshake signals. It can handle interrupts and also the output and inputs are latched.

Functional block diagram of 8255

Control Word for I/O mode

For I/O mode the most significant bit (D7) is 1. Also, to set port A mode pins D6 & D5 are used.

  • D4 : This pin is used to check whether port A is taking input or displaying the output. If it is 1 then input else output.
  • D3: The higher bits of port C are taking input or output which is decided through D3. If 1, then input else output.
  • D2: The port B modes are decided through this pin. If 0, then port B is in M0 mode else in M1 mode.
  • D1: In order to check that port B takes input or displays output is checked through D1. If 1, then input else output.
  • D0: The lower bits of port C are taking input or displaying output is decided through D0. If 1, then it takes input else displays output.

You may also like