Interfacing with Peripheral Devices

Peripheral interfacing uses programmable chips — the 8255 for parallel I/O, the 8253/8254 for timing, the 8259 for interrupts — configured by writing control words; the timer count = input clock / desired output frequency.

Key formulas & points

Skim these first — then read the full notes below.

  • Memory-mapped vs I/O-mapped addressing
  • Handshake signals STB, ACK for parallel I/O
  • Keyboard matrix scan and 7-segment display multiplexing

Topic details

Introduction

The 8255 Programmable Peripheral Interface provides three 8-bit ports (A, B, C) whose direction and mode are set by a control word. Mode 0 is simple I/O, mode 1 adds handshaking, and mode 2 is bidirectional on port A.

Scope in B.Tech and GATE syllabus

The 8253/8254 timer divides an input clock to generate delays or frequencies; the loaded count equals the input clock frequency divided by the desired output frequency.

Key relations & formulas

Formulas (Indian textbook notation)

  • 8255PPI:threeportsA,B,C;modes0,1,28255 PPI: three ports A, B, C; modes 0, 1, 2

Formulas (Indian textbook notation)

  • 8253/8254timer:count=inputclockdesiredfrequency8253/8254 timer: count = input \frac{clock}{desired} frequency

Formulas (Indian textbook notation)

  • 8259PIC:interruptpriorityandvectoring8259 PIC: interrupt priority and vectoring

Notation and sign conventions

Relation 1 —
8255PPI:threeportsA,B,C;modes0,1,28255 PPI: three ports A, B, C; modes 0, 1, 2

Formulas (Indian textbook notation)

  • 8255PPI:threeportsA,B,C;modes0,1,28255 PPI: three ports A, B, C; modes 0, 1, 2
Write this relation with symbols exactly as in Microprocessor Architecture & Programming — Ramesh Gaonkar before substituting numbers. Examiners award partial marks for a correct setup even when arithmetic slips.
Relation 2 —
8253/8254timer:count=inputclockdesiredfrequency8253/8254 timer: count = input \frac{clock}{desired} frequency

Formulas (Indian textbook notation)

  • 8253/8254timer:count=inputclockdesiredfrequency8253/8254 timer: count = input \frac{clock}{desired} frequency
Write this relation with symbols exactly as in Microprocessor Architecture & Programming — Ramesh Gaonkar before substituting numbers. Examiners award partial marks for a correct setup even when arithmetic slips.
Relation 3 —
8259PIC:interruptpriorityandvectoring8259 PIC: interrupt priority and vectoring

Formulas (Indian textbook notation)

  • 8259PIC:interruptpriorityandvectoring8259 PIC: interrupt priority and vectoring
Write this relation with symbols exactly as in Microprocessor Architecture & Programming — Ramesh Gaonkar before substituting numbers. Examiners award partial marks for a correct setup even when arithmetic slips.

Fundamentals and definitions

Addressing choice: I/O-mapped uses IN/OUT instructions and a separate I/O space (fewer address lines decoded); memory-mapped treats ports as memory locations, allowing the full instruction set to access them at the cost of memory address space.

Governing relations in practice

Handshaking (strobe STB, acknowledge ACK) synchronises data transfer with slow peripherals so neither side loses data; the 8255 mode 1 generates these signals automatically.

Design and analysis considerations

Display multiplexing drives several 7-segment digits from one port by rapidly enabling each in turn; persistence of vision makes them appear continuously lit, saving I/O lines.

Assumptions and validity limits

State assumptions explicitly before using any relation for interfacing with peripheral devices — steady state, uniform properties, linear elastic material, ideal gas, incompressible flow, etc., as applicable.
Wrong assumptions invalidate the entire solution even when the formula is correct. In Microprocessors viva and GATE descriptive questions, listing valid assumptions often earns separate marks.

Step-by-step problem approach

1. Read the question and list given data with SI units (common in Microprocessors papers).
2. Draw a neat labelled diagram where applicable — examiners in Indian universities award diagram marks even when arithmetic slips.
3. Identify which relation from this topic applies to interfacing with peripheral devices.
4. Use equation 1:
8255PPI:threeportsA,B,C;modes0,1,28255 PPI: three ports A, B, C; modes 0, 1, 2
.
5. Use equation 2:
8253/8254timer:count=inputclockdesiredfrequency8253/8254 timer: count = input \frac{clock}{desired} frequency
.
6. Substitute values, compute, and verify units and sign (direction).
7. State conclusion in one line — e.g. safe/unsafe, stable/unstable, feasible/infeasible.

Applications & exam relevance

Interfacing with Peripheral Devices appears in embedded and industrial controllers. In Indian electrical curricula this topic is tested because it connects theory to 8086 architecture and interfacing.
GATE and semester exams often combine interfacing with peripheral devices with earlier units — revise prerequisites before attempting mixed problems.
Industry interview panels sometimes ask: "Where did you use interfacing with peripheral devices?" — answer with a lab, mini-project, or plant visit example if possible.

Common mistakes in exams

• Writing the 8255 control word to the wrong (port) address instead of the control register
• Computing timer count as clock × frequency instead of clock / frequency
• Confusing memory-mapped and I/O-mapped addressing methods
• Omitting handshake signals for slow peripherals

Quick revision checklist

Before attempting interfacing with peripheral devices problems, confirm you can:
1. Memory-mapped vs I/O-mapped addressing
2. Handshake signals STB, ACK for parallel I/O
3. Keyboard matrix scan and 7-segment display multiplexing
Revise the solved examples in Microprocessor Architecture & Programming — Ramesh Gaonkar and one previous-year GATE or university paper for this unit.

Worked examples

Try the problem first — open the solution when you are ready to check.

Timer count for a target frequency

Problem

An 8254 timer is clocked at 1.5 MHz and must generate a 1 kHz square wave in mode 3. Find the count value to load.

Solution

Count = input clock / desired frequency.
= 1.5×10⁶ / 1×10³.
Count = 1500.
Load 1500 (decimal) into the timer’s count register.

Conceptual check — Interfacing with Peripheral Devices

Problem

In a Microprocessors semester or GATE paper you are asked: "State the main assumption, the governing relation, and one practical consequence of interfacing with peripheral devices." What should a complete answer include?

Exams & GATE

Gaonkar — initialise 8255 for mode 1 input port.

📖 Standard books (India)

  • Microprocessor Architecture & ProgrammingRamesh Gaonkar

    Read: Syllabus unit

    8085/8086 — widely used in Indian colleges