The Intel 8255A IC programming modes

| |
The intel 8255A IC is a PPI(Programmable Peripheral Interface) IC that is used for parallel communication interfacing between a CPU such as intel 8085 and I/O devices such as printer or keyboard. The Intel 8255 has two functional mode which are Bit Set Reset(BSR) mode and the I/O mode. The I/O mode has futher 3 modes which are generally called mode 0, mode 1 and mode 2. The mode 0 is also known as simple I/O mode, mode 1 is known as handshaking mode and mode 2 is called bidirectional mode.

In Bit Set Reset(BSR) mode, the port C pins are can be individually set or reset. The mode 0 or simple I/O mode is the ports configuration in which the port A and port B are used for either simple input or output ports and the port C port is used for handshaking. In mode 3 or bidirectional mode, the port A is used for bidirectional port with C port bits as handshaking while port B is used in simple I/O port(mode 0) or handshaking(mode 1).

To configure the 8255A ports we write control word and send it the control register from the CPU like intel 8085 via the data bus. The control word bits are such that when the MSB of the 8 bit word is 0 then it indicates BSR mode and when it is 1 then it indicates I/O mode. Thus the first bit of the control word is for choosing which of the primary functions, that is, BSR or I/O mode is to use.

If in case BSR is chosen so that the first bit is 0, then the 7th, 6th and 5th bits are dont care which means that it doesnt matter whether they are 1 or 0 bit. Then the next 4th, 3rd and 2nd bit combination selects the 8 pins of the port C. This means that upon the selection of the combination of the 4th, 3rd and 2nd bits we can choose which one of the port C pin to set or reset. The 1st bit or the LSB is for set or reset. That is 1 indicates set and 0 indicates reset.

If in case I/O mode is selected so that first bit is 1, then remaining 7 bits of the control words is to configure-

- port A either as mode 0, mode 1 or mode 2, and either as input or output port
- port B either as mode 0 or mode 1 and either as input or output port
- port C either as input or output

The simple I/O mode or mode 0 configuration is the simplest control word configuration. The handshaking mode/ mode 1 is the more difficult which is explained next.

In the handshaking mode, port A and port B can be configured as either input or output port. The port C pins are used for handshaking control signals which are STB active low, IBF active high and INTR if the port is configured as input port and OBF active low, ACK active low and INTR active low.


There are 8 pins of port C which are configured depending whether the port A and port B are input or output.

If for example A and B ports are configured as input port then,

PC7 - either input or output
PC6 - either input or output
PC5a - IBFa
PC4a - STBa
PC3a - INTRa
PC2b - STBb
PC1b - IBFb
PC0b - INTRb

where indicates active low signal and a, b indicates port A and port B

If A and B ports are configured as output port then,

PC7a - OBFa
PC6a - ACKa
PC5 - either input or output
PC4 - either input or output
PC3a - INTRa
PC2b -ACKb
PC1b - OBFb
PC0b - INTRb

Thus when the port A is an input port in the mode 1 configuration then PC5, PC4, PC3 are reserved. Similarly when port A is an output port in mode1 then PC7, PC6 and PC3 are reserved. In case of port B this is not the situtation, that is whether it is a input or output PC2, PC1 and PC0 are reserved for port B.

The final mode is the mode2 or  the strobe bidirectional bus I/O mode. In this mode only the port A can be used for bidirectional 8 bit I/O bus using the port Cs PC7 to PC3 for handshaking. Port B can be programmed only in mode0 or mode1. In case port B is configured as mode0 then PC2 to PC0 is used for input or output and in case it it configured as mode1 then PC2 to PC0 are used for handshaking.




Related Posts by Categories

0 comments:

Post a Comment