Mode 2—bi-directional I/O

MicroprocessorMicrocontroller8085

In mode 0 or mode 1, a port works as an input port or an output port. It is dependent if an input device or an output device gets connected to the port. Moreover, this, mode 2 is often called as bi-directional handshake Input Output. It is beneficial for us when the microprocessor receives information, and sometimes sends information to the Input Output device which is connected to 8255. An example to be cited as for the communication process with a floppy disk controller card. Since mode 2 is bi-directional handshake Input Output, it needs more number of handshake lines than the uni-directional mode 1 which is strobed Input Output.

Thus, the operations of mode 2 makes use of the five lines of Port C for the purposes of handshaking. These five lines of Port C ranges from PC7 to PC3. For performing the input operation, PC5, PC4, and PC3 pins provides the handshake signals for Port A when we configure as mode 2. For performing the output operation, PC7, PC6, and PC3 pins provides the handshake signals for Port A when we configure it as mode 2.

Example 1: Configure Port A as bi-directional I/O port, Port B as basic input port, and PC2-0 as output lines.

The required mode definition control word is shown in below −

Bit 0 must be a 0 to indicate that PC2-0 are output lines. In this case it does not mean that the entire Port C lower is output, as PC3 is used for handshaking purposes.

It is to be noted that the bit 3 is a don't care. This is because all the four lines of Port C upper are used for handshaking purposes some of which will be input pins and some others will be outputs. The 8255 will automatically configure these handshake pins, and so it is unimportant whether bit 3 is a 0 or 1.

Bit 4 is a don't care because Port A is required to work in bi-directional mode. The instructions to achieve this requirement assuming the chip select circuit as shown above are as follows.

MVI A, C2H ; Treating X as 0
OUT 23H
raja
Published on 13-Mar-2019 07:17:27
Advertisements