Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

Unit 4 — Input-Output Interfaces

Lesson 39 of 49 in the free Computer Organization and Architecture notes on Siksha Sarovar, written by Rohit Jangra.

The I/O Interface Unit

An I/O interface provides a method for transferring information between internal storage (CPU and memory) and external I/O devices. It resolves the speed, format, signal-level and protocol mismatches identified in the previous lesson.

1. Structure of an Interface Unit

   Every interface contains at least four registers:

   1. DATA REGISTER (buffer)  : holds the byte/word being transferred
   2. STATUS REGISTER         : flags — ready, busy, error, done
   3. CONTROL REGISTER        : commands from the CPU — start, stop, mode
   4. ADDRESS DECODER / CS    : recognises the addresses assigned to
                                this interface

   Plus:
      - Bus buffers (tri-state) so the interface can share the data bus
      - Timing and control logic
      - Device-specific circuitry (serialiser, level shifter, DAC/ADC...)

2. I/O Bus and Interface Modules

   The I/O bus carries three groups of lines:

      DATA lines     : the actual information
      ADDRESS lines  : which device / which register inside it
      CONTROL lines  : what to do (read, write, status, control)
   Typical control codes placed on the control lines:

      Control command : activate the device (e.g. start the motor,
                        rewind the tape). Does not transfer data.
      Status command  : test various status conditions in the interface.
      Data output     : the interface accepts a data item from the bus.
      Data input      : the interface places a data item on the bus.

3. Isolated I/O vs Memory-Mapped I/O

This comparison is a guaranteed exam question.

BasisIsolated (I/O-mapped) I/OMemory-mapped I/O
Address spaceSeparate for memory and I/OShared — devices occupy memory addresses
InstructionsSpecial: IN, OUTAny memory instruction: LOAD, STORE, ADD, MOV
Control linesMEMR, MEMW, IOR, IOW (4)MEMR, MEMW (2)
Address lines used for I/OFew (e.g. 8) → 256 portsFull width → fewer memory locations available
Instruction set sizeLarger (extra opcodes)Smaller
Flexibility of operations on device registersLimited (only IN/OUT)Full — you can ADD directly to a device register
Memory space lostNoneYes — device addresses are unusable for memory
DecodingSimplerMore complex (full address must be decoded)
ExamplesIntel 8085/8086, x86Motorola 68000, ARM, most RISC, all modern SoCs
   Example — read a status byte from a device at port 0x40:

   Isolated I/O (8085):        IN 40H            ; AC <- port 40
   Memory-mapped (ARM):        LDR R1, [R0]      ; R0 = 0xE0000040

4. Example: The Intel 8255 Programmable Peripheral Interface

   A general-purpose interface chip with 24 I/O lines:

      Port A : 8 lines
      Port B : 8 lines
      Port C : 8 lines (can be split into two 4-bit halves)
      Control register : programs the direction and mode of each port

   Address decoding uses two lines A1 A0:
      00 -> Port A       10 -> Port C
      01 -> Port B       11 -> Control register

   The CPU writes a CONTROL WORD to the control register to configure
   each port as input or output — this is what "programmable" means.
   Bidirectional data transfer with the 8255:

      CPU -> Control register : set Port A = output, Port B = input
      CPU -> Port A           : data appears on the 8 output pins
      CPU <- Port B           : data on the 8 input pins is read

5. Serial Communication Interface — the UART

   UART = Universal Asynchronous Receiver Transmitter

   Transmit side: a PISO shift register converts a parallel byte
                  into a serial bit stream (Unit II!)
   Receive side : a SIPO shift register converts the serial stream
                  back into a parallel byte

   Also handles: start/stop bit framing, parity generation and checking,
                 baud rate generation, error flags.
Interface standardTypeTypical use
RS-232Serial, ±12 VLegacy terminals, industrial equipment
USBSerial, differentialUniversal peripheral connection
I2CSerial, 2 wiresOn-board sensors
SPISerial, 4 wiresFast on-board devices
PCI / PCIeParallel / serial lanesInternal expansion cards
SATA / NVMeSerialStorage devices

6. Serial vs Parallel Transmission

BasisSerialParallel
Wires1 (or a differential pair)n (one per bit)
Speed per wireHighLower (skew limits it)
DistanceLongShort (crosstalk, skew)
CostLowHigh
Modern trendDominant (USB, SATA, PCIe)Declining (only on-chip)
   Why serial won: at gigahertz rates, the arrival times of parallel bits
   on different wires (CLOCK SKEW) diverge more than one bit period.
   A single serial lane with an embedded clock avoids this entirely.

7. Complete I/O Command Types

CommandEffect
ControlActivate the peripheral, tell it what to do
StatusRead flags — ready, busy, error
Data outputCPU → interface → device
Data inputDevice → interface → CPU

Summary

   Interface unit = data register + status register + control register
                    + address decoder + bus buffers

   Isolated I/O   : separate address space, IN/OUT instructions
   Memory-mapped  : shared address space, ordinary instructions

   The interface resolves the CPU-peripheral mismatch, but does NOT
   solve the SYNCHRONISATION problem: how does the CPU know the device
   is ready? That is the subject of the next lesson.