IO Device Interfaces: Short Notes (Two Topics)
Input/Output (I/O) device interfaces define how the CPU and an I/O device communicate over a system bus—covering addressing, data transfer, synchronization, and signaling. Two common interface mechanisms are: Programmed I/O (Port I/O / Memory-mapped I/O) and Interrupt-based I/O (often combined with DMA in advanced systems).
keyword
keyword
keyword
keyword
Note: You asked for “any two” short notes; the course section below provides two complete short notes: (1) Port I/O vs Memory-mapped I/O and (2) Interrupt-driven I/O (with optional DMA context).
I/O Concepts: Programmed I/O, Interrupts, and DMA (Educational Overview)
Short Note 1 — Port-Mapped I/O vs Memory-Mapped I/O (Programmed I/O)
Programmed I/O is when software explicitly reads/writes device registers, typically by the CPU executing instructions that access an I/O address space or memory address space.
1) Port-mapped I/O (Paced by I/O instructions)
In port-mapped I/O, the CPU uses dedicated I/O instructions and addresses I/O ports rather than normal memory addresses. Each port corresponds to a device register (data, status, control). The device interface typically includes:
- Address decoding (which port/register is targeted)
- Read/write strobes (signals that qualify access)
- Data path (data bus into/out of the device)
- Status signaling (e.g., ready/not-ready)
keyword
keyword
keyword
keyword
2) Memory-mapped I/O (MMIO)
In memory-mapped I/O, a device’s registers are assigned memory addresses. The CPU accesses the device by normal load/store operations to those addresses. The interface provides:
- MMIO address decoding (which address range belongs to the device)
- Read/write handling (mapping bus cycles to device register operations)
- Ordering/visibility considerations (to ensure software observes the correct device state)
keyword
keyword
keyword
3) Comparison (typical exam points)
| Aspect | Port-mapped I/O | Memory-mapped I/O (MMIO) |
|---|---|---|
| Address space | Separate I/O space | Uses normal memory addresses |
| CPU access style | Specialized I/O instructions | Regular load/store instructions |
| Register access | Port numbers map to registers | Addresses map to registers |
| Typical systems | Older x86-style I/O model in classic descriptions | Common in modern architectures |
How CPU performs Programmed I/O (typical flow)
- 1Step 1
Software chooses the port number or MMIO address that maps to a specific device register (data/control/status).
- 2Step 2
CPU executes an I/O instruction (port-mapped) or a normal load/store (MMIO) to perform the access.
- 3Step 3
The device interface decodes the address and asserts internal control so the correct register is read or written.
- 4Step 4
Software often polls the status register until the device indicates ready/buffer available.
- 5Step 5
Once the device signals completion (or provides the data), software proceeds to the next operation.
Exam Tip: What to mention in a short note
When writing a short note on I/O interfaces, include: (i) addressing method (port vs MMIO), (ii) control & status registers, (iii) how reads/writes are signaled (read/write strobes or bus cycles), and (iv) typical software behavior (polling).
Short Note 2 — Interrupt-Driven I/O Interface (and DMA Context)
Instead of busy-wait polling, an I/O device can notify the CPU using an interrupt. This reduces wasted CPU cycles and improves responsiveness.
1) Interrupt signaling mechanism (interface view)
An interrupt interface typically includes:
- Interrupt request line (IRQ) or an interrupt message mechanism
- Interrupt controller that prioritizes and masks interrupts
- Interrupt acknowledgment so the CPU/device interface knows the request was accepted
- ISR (Interrupt Service Routine) executed by the CPU
keyword
keyword
keyword
2) Typical interrupt-driven workflow
When the I/O device has data ready (or completed an operation), it asserts an IRQ. The CPU:
- Saves context (as per architecture)
- Jumps to the ISR
- In the ISR, reads the device’s status/data registers
- Clears the interrupt condition at the device (e.g., via control/status register)
- Returns to normal execution
3) Why DMA often appears with interrupt I/O
Many devices transfer more data than is efficient to move byte-by-byte using programmed I/O. Therefore, systems often combine:
- Interrupts to indicate transfer completion or errors
- DMA to perform bulk transfer directly between device and memory
DMA interfaces add:
- Bus mastering / arbitration
- Transfer size and addressing
- Modes like burst/continuous transfers and flow control
keyword
keyword
keyword
Interrupt-driven I/O (high-level algorithm)
- 1Step 1
An I/O device becomes ready (data available) or finishes a command (operation complete).
- 2Step 2
The device signals the interrupt controller/CPU via an IRQ line or interrupt message.
- 3Step 3
The controller checks priority and masking, then signals the CPU to enter the ISR.
- 4Step 4
The ISR reads device status/data registers and handles the event.
- 5Step 5
The ISR updates a control/status register so the interrupt condition is removed.
- 6Step 6
After servicing, the CPU returns to the previously running program.
Common pitfall: forgetting to clear the interrupt source
In interrupt-driven systems, the ISR must clear the device’s interrupt condition (usually via device registers). Otherwise, the CPU can repeatedly re-enter the ISR (interrupt storm).
From Programmed I/O to Interrupt/DMA (Conceptual Progression)
Polling (Programmed I/O)
Step 1CPU repeatedly checks device status registers until ready."
Interrupt-driven handling
Step 2Device signals CPU; CPU runs ISR to process the event."
DMA acceleration (optional)
Step 3DMA moves bulk data; interrupts typically signal completion/errors."
Quick Clarifications
Qualitative trade-off: Polling vs Interrupt-driven I/O
Higher is better for responsiveness and efficiency; note this is qualitative (not measured data).
Knowledge Check
In memory-mapped I/O (MMIO), device registers are accessed using:
Explore Related Topics
Various Addressing Modes of 8051 Microcontroller
The 8051 microcontroller provides multiple addressing modes that define how an instruction identifies the location or value of its operand.
- Immediate (
#data) – constant value encoded in the instruction, used for loading fixed numbers. - Register (
Rn) – operand resides in CPU registers R0‑R7 (or A/B), giving the shortest and fastest code. - Direct (
addr) – 8‑bit address is part of the opcode, accessing internal RAM or SFRs directly. - Register indirect (
@R0,@R1,@DPTR) – a register holds the operand’s address, enabling pointer‑like traversal of memory. - Indexed (
@A+DPTRor@A+PC) – adds the accumulator to DPTR or PC for table look‑ups in code memory; branch modes (relative, absolute, long) extend this concept for short, page‑limited, and full‑range jumps.
Multiplexing: Short Notes with Key Concepts and Applications
Interfacing Stepper Motors: Architecture, Drivers, and Control
The course explains how stepper motors work, the differences between bipolar and unipolar designs, and how to drive them safely using dedicated driver ICs such as the A4988, with example code for microcontrollers.
- Step angle is determined by rotor teeth and phases; a typical 1.8° motor yields 200 steps per revolution.
- Unipolar motors use center‑tapped windings for simpler drivers but lower efficiency, while bipolar motors require H‑bridge drivers and provide higher torque‑to‑size.
- Driving modes include wave (one phase), full‑step (two phases), and half‑step (alternating) to trade torque versus resolution.
- Interfacing a bipolar motor to an A4988 involves correct coil identification, power decoupling, STEP/DIR wiring, optional microstepping pins, and Vref current‑limit calibration.
- Sample Arduino C++ and Raspberry Pi Python sketches illustrate basic step‑and‑direction control, emphasizing the need for current‑limiting and back‑EMF protection.