- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Mode 2—bi-directional I/O
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
- Mode 1—strobed I/O
- Comparison of memory-mapped I/O and I/O-mapped I/O
- I/O-mapped I/O or memory-mapped I/O in 8085 Microprocessor
- I/O-mapped I/O in 8085 Microprocessor
- Demerits of I/O-mapped I/O and merits of memory-mapped I/O
- Merits of I/O-mapped I/O and demerits of memory-mapped I/O
- Differentiate between programmed I/O and interrupt driven I/O.
- What is the difference between Directional Coupler and two-hole directional coupler?
- I/O Systems and Subsystems
- Interfacing of I/o Devices
- I/O Redirection in C++
- Checking information about basic I/O operations on I/O subsystems in SAP HANA
- Operating System Input Output I/O
- What is Interrupt I/O Process?
- What is the I/O structure?