6 Input Output Interfaces

Microprocessor · Unit 6 · 6 hrs

Input/ Output Interfaces

Exam-focused notes for Input/ Output Interfaces (Microprocessor, CSC167): what the TU syllabus asks and how it has actually been tested, with 8 solved past questions from this unit.

Input/ Output Interfaces in short

This chapter covers how the microprocessor is connected to real peripheral devices: the difference between parallel and serial transfer, the ports and handshaking schemes used to move data reliably, and the two support chips most commonly used for peripheral interfacing, the 8259A interrupt controller and the 8255A parallel interface.

Input/ Output Interfaces: notes

Interfacing Concepts

An interfacing circuit exists because a raw microprocessor bus and a real peripheral device rarely operate at the same speed or in the same format: they may differ in timing, in signal voltage levels, and in whether data moves one bit or many bits at a time. Two basic transfer schemes are used.

Parallel communicationSerial communication
Bits moved per transferAll bits of a word at onceOne bit at a time
SpeedFasterSlower
HardwareMore complex, one line per bitSimple, one or two lines
Typical useShort distance, high speed, for example a printer or memory busLong distance, for example a modem link
Example device8255A PPI8251A USART, RS-232C

Ports

A port is the addressable point through which the microprocessor exchanges a byte with the outside world, functionally similar to a memory location but selected through the I/O address space (or a reserved part of the memory space, in memory-mapped I/O). The 8255A programmable peripheral interface exposes three 8-bit ports, A, B and C, with port C further splittable into two 4-bit halves; which of the three ports (or the internal control register) is being accessed on a given cycle is selected by the two address lines $A_1$ and $A_0$.

$A_1$$A_0$Selects
00Port A
01Port B
10Port C
11Control register

Interfacing Of I/O Devices

Several handshaking schemes are used depending on how much coordination a device needs.

  • Simple I/O: used for a device with no timing requirement of its own, such as an LED. The microprocessor just writes the required logic level to an output port; no acknowledgement is needed.
  • Strobe I/O: used when the peripheral itself announces when data is valid, such as an ASCII-encoded keyboard. The device places its data on the bus and pulses a strobe (STB) line to tell the microprocessor when to read it.
  • Single handshake I/O: the peripheral asserts STB when it has placed valid data on the bus; the microprocessor detects STB, by polling or by interrupt, reads the data, and then pulses an acknowledge (ACK) line back to tell the peripheral it can send the next byte.
  • Double handshake I/O: adds coordination in both directions. The peripheral first raises STB to say it is ready to send; the receiver raises ACK to say it is ready to receive; only then does the peripheral place the data on the bus, and the receiver drops ACK once the byte has been taken, signalling that the next byte can be sent. This extra exchange is used when both sides need positive confirmation before and after each transfer.

What this unit covers

  • Interfacing Concepts
  • Ports
  • Interfacing Of I/O Devices
  • Interrupts In 8085
  • Programmable Interrupt Controller 8259A
  • Programmable Peripheral Interface 8255A

Programmable Peripheral Interface 8255A

2081 · 5 marks

List out the limitation of parallel communication. Explain the different operation modes of 8255A PPI. [5]

Show solved answer

Limitations of Parallel Communication and Operation Modes of 8255A PPI


Part 1: Limitations of Parallel Communication

Parallel communication transmits multiple bits simultaneously over multiple lines, but it has the following limitations:

  1. Cost: Requires more wires/lines (one for each bit), making it more expensive than serial communication.
  2. Distance Limitation: Suitable only for short distances (typically within a few meters) because signal degradation and crosstalk increase with distance.
  3. Crosstalk: Interference between adjacent parallel lines causes data errors, especially at high speeds over longer distances.
  4. Synchronization Problem: All bits must arrive at the same time; skew (timing differences between lines) can cause data corruption.
  5. Cable Bulk: Multiple wires make the cable thick, heavy, and difficult to manage.
  6. Higher Power Consumption: More lines mean more drivers and receivers, consuming more power.
  7. Not Suitable for Long Distance: Cannot be used effectively for long-distance communication unlike serial communication.

Part 2: Operation Modes of 8255A PPI

csc167-8255-block

The 8255A Programmable Peripheral Interface (PPI) has three ports: Port A, Port B, and Port C. It operates in the following modes, determined by the Control Word Register (bit D7 = 1 for I/O mode):


Mode 0: Basic Input/Output Mode

  • This is the simplest mode of operation.
  • Port A, Port B, and both halves of Port C (upper and lower) can be independently configured as input or output.
  • No handshaking signals are required.
  • Data is simply written to or read from the ports.
  • Suitable for simple I/O operations like reading switches or driving LEDs.
  • Port C can be split: upper nibble (PC7-PC4) and lower nibble (PC3-PC0) configured separately.

Example use: Connecting keyboards, displays, or simple peripheral devices.


Mode 1: Strobed Input/Output Mode (Handshaking Mode)

  • Used for Port A and Port B only.
  • Port C lines are used as handshaking/control signals for Port A and Port B.
  • Data transfer occurs with synchronization signals (handshaking).
  • Two sub-modes:
    • Mode 1 Input: Uses signals like STB (Strobe), IBF (Input Buffer Full), and INTR (Interrupt Request).
    • Mode 1 Output: Uses signals like OBF (Output Buffer Full), ACK (Acknowledge), and INTR.
  • Suitable when the peripheral needs to signal readiness before data transfer.

Example use: Interfacing with printers or other devices requiring handshaking.


Mode 2: Bidirectional Bus Mode

  • Available for Port A only.
  • Port A acts as a bidirectional 8-bit data bus (both input and output on the same port).
  • Port C lines (PC7-PC3) are used as control/handshaking signals for Port A.
  • Port B can still operate in Mode 0 or Mode 1 independently.
  • Suitable for communication between two microprocessors or complex peripherals.

Example use: Data transfer between two CPUs sharing a common bus.


Bit Set/Reset (BSR) Mode

  • This is a special mode for Port C only.
  • When bit D7 = 0 in the control word, Port C operates in BSR mode.
  • Individual bits of Port C can be set (1) or reset (0) using a specific control word.
  • This does not affect Port A or Port B operations.
  • Useful for generating control signals or flags on individual pins.

Summary Table

ModePortFeature
Mode 0A, B, CSimple I/O, no handshaking
Mode 1A and BStrobed I/O with handshaking
Mode 2A onlyBidirectional data bus
BSRC onlyIndividual bit set/reset
Open this answer on its own page →

2080 · 5 marks

What are different modes of parallel I/O? Differentiate between synchronous serial communication and asynchronous serial communication. [5]

Parallel I/O is commonly implemented using programmable peripheral interface chips like the 8255A. It supports the following modes: - Provides simple input/output operations for all three ports (A, B, C). - No handshaking is required. - Any port can be configured as input or output independently....

Open this answer on its own page →

2079 · 5 marks

What is the purpose of Programmable Peripheral Interface 8255A? Explain about its different ports. [5]

Show solved answer

Programmable Peripheral Interface 8255A

Purpose of 8255A

The 8255A is a widely used programmable parallel I/O device designed to interface a microprocessor with peripheral devices. Its main purposes are:

  • It can be programmed to transfer data under various conditions, ranging from simple I/O to interrupt-driven I/O.
  • It is flexible, versatile, and economical, especially when multiple I/O ports are required.
  • It is a general-purpose I/O device that can be used with almost any microprocessor (including the 8085).
  • It reduces the complexity of interfacing external devices by providing programmable control through a control register.

Ports of 8255A

The 8255A has 24 I/O pins organized into three ports: Port A, Port B, and Port C.

1. Port A (8-bit)

  • A full 8-bit parallel port.
  • Can be configured as input or output.
  • Supports all three operating modes: Mode 0, Mode 1, and Mode 2.
  • In Mode 2 (bidirectional), only Port A can be used for bidirectional data transfer.

2. Port B (8-bit)

  • A full 8-bit parallel port.
  • Can be configured as input or output.
  • Supports Mode 0 and Mode 1 only (not Mode 2).

3. Port C (8-bit)

  • An 8-bit port that can be used in two ways:
    • As a single 8-bit port for simple I/O.
    • Split into two 4-bit ports:
      • C Upper (C_U) -- upper nibble (bits 7-4)
      • C Lower (C_L) -- lower nibble (bits 3-0)
  • Port C is often used to provide control/status signals (handshake signals) for Port A and Port B in Mode 1 and Mode 2 operations.
  • Individual bits of Port C can be set or reset using the Bit Set/Reset (BSR) feature.

Data Bus Buffer

The 8255A also contains a three-state bidirectional 8-bit buffer that interfaces it to the system data bus. Data is transmitted or received through this buffer upon execution of input/output instructions by the CPU. Control words and status information are also transferred through this buffer.


Summary Table

PortSizeModes SupportedSpecial Feature
Port A8-bitMode 0, 1, 2Bidirectional in Mode 2
Port B8-bitMode 0, 1Strobed I/O in Mode 1
Port C8-bitMode 0Split into C_U and C_L; Bit Set/Reset

The functions of all ports are defined by writing a control word into the control register of the 8255A, making it highly programmable and adaptable to various interfacing requirements.

Open this answer on its own page →

2078 · 5 marks

What are the different modes of parallel communication? Construct a control word for 8255 PPI for following configuration: .a) Port A and Port C_upper = mode 0 .b) Port B and Port C_lower = mode 0 c.) Port A and Port C_upper as input port d.) Port B and Port C_lower as output port [5]

Configuration requirements: - a) Port A and Port Cupper = Mode 0 - b) Port B and Port Clower = Mode 0 - c) Port A and Port Cupper = Input - d) Port B and Port Clower = Output Mode 0 - Simple Input/Output - Basic I/O without handshaking. - Ports A, B, Cupper, Clower can each be independently set a...

Open this answer on its own page →

Interfacing Concepts

2076 · 5 marks

Differentiate between synchronous and asynchronous serial communication. Show DTE-DTE and DTE-DCE connection according to RS-232 serial communication standard. [5]

--- Feature Synchronous Asynchronous --------- Clock Sender and receiver share a common clock signal No shared clock; each character is self-timed Data framing Data is sent as a continuous stream of blocks/frames Each byte is framed with a start bit and stop bit(s) Speed Generally faster; no over...

Open this answer on its own page →

2075 · 5 marks

How DTE and DCE are wired using Rs-232 cables. Explain the process of double handshake I/O. [5]

--- - DTE (Data Terminal Equipment): The device that generates or consumes data, e.g., a computer or terminal. - DCE (Data Communication Equipment): The device that provides the communication channel, e.g., a modem. Pin Signal Direction Description ------------------------------------- 2 TxD DTE ...

Open this answer on its own page →

Programmable Interrupt Controller 8259A

2075 · 5 marks

Differentiate between vectored and non-vectored interrupts. Where and how 8259 PIC can be used to handle interrupts. [5]

--- Feature Vectored Interrupt Non-Vectored (Polled) Interrupt --------- Definition The interrupting device identifies itself and provides the address (vector) of its ISR directly to the CPU The CPU must poll each device to find out which one requested the interrupt Speed Faster, since the CPU ju...

Open this answer on its own page →

2080.1 · 5 marks

List different types of ports. What are the main characteristics of programmable interrupt controller 8259A? [5]

--- Ports are the interfaces through which the CPU communicates with external devices. The main types of ports are: - Used to transfer data from peripheral devices to the CPU. - Example: Keyboard port, scanner port. - Used to transfer data from the CPU to peripheral devices. - Example: Printer po...

Open this answer on its own page →