5 Basic I O Memory R W And Interrupt Operations

Microprocessor · Unit 5 · 6 hrs

Basic I/O, Memory R/W and Interrupt Operations

Exam-focused notes for Basic I/O, Memory R/W and Interrupt Operations (Microprocessor, CSC167): what the TU syllabus asks and how it has actually been tested, with 10 solved past questions from this unit.

Basic I/O, Memory R/W and Interrupt Operations in short

This chapter covers how the 8085 reads and writes memory and I/O devices, how a DMA controller can move data without the CPU's involvement, and how interrupts let an external device demand the processor's attention.

Basic I/O, Memory R/W and Interrupt Operations: notes

Memory Read

A memory read operation transfers one byte from a memory location into the microprocessor. The microprocessor places the 16-bit address on the address bus, asserts $IO/\overline{M} = 0$ to mark the cycle as a memory operation, and pulls $\overline{RD}$ low; the addressed memory chip then drives the byte onto the data bus, from where the microprocessor reads it. Instructions such as LDA (load the accumulator directly from an address) and MOV r, M (move the byte addressed by the H-L pair into a register) both use this cycle.

Memory Write

A memory write operation transfers a byte from the microprocessor into memory. The address is placed on the address bus with $IO/\overline{M} = 0$, the byte to be written is placed on the data bus, and $\overline{WR}$ is pulled low so the addressed memory location latches it. STA (store the accumulator to an address) and MOV M, r are examples.

I/O Read

An I/O read brings a byte from an input port into the microprocessor, using the IN instruction. Two schemes exist for addressing I/O devices.

Memory-mapped I/OI/O-mapped I/O
Treats I/O asPart of the memory address spaceA separate address space
Address lines usedFull 16-bit address, A0-A158-bit port address, A0-A7
Devices addressableUp to $2^{16} = 65{,}536$Up to $2^{8} = 256$
InstructionsLDA, STA, MOV MIN, OUT
Decoding hardwareMore, since it shares the full address space with memoryLess
Memory left availableLess, since I/O consumes part of the address spaceMore, since I/O has its own address space

For I/O-mapped I/O, an IN instruction places the 8-bit port address on the lower half of the address bus, asserts $IO/\overline{M} = 1$, and pulls $\overline{RD}$ (acting as $\overline{IOR}$) low so the selected port drives its data onto the data bus.

What this unit covers

  • Memory Read
  • Memory Write
  • I/O Read
  • I/O Write
  • Direct Memory Access
  • Interrupt
  • Types
  • Interrupt Masking

Interrupt Masking

2081 · 5 marks

What do you mean by vectored interrupt? Explain maskable and non-maskable interrupts in 8085 microprocessor. [5]

Show solved answer

Vectored Interrupt, Maskable and Non-Maskable Interrupts in 8085


Vectored Interrupt

A vectored interrupt is an interrupt in which the interrupting device not only signals the processor for attention but also identifies itself by providing the address (vector) of its Interrupt Service Routine (ISR) directly.

  • When a vectored interrupt occurs, the microprocessor automatically jumps to a fixed, pre-defined memory address associated with that interrupt, without needing to poll or search for the source.
  • This makes the response faster and more efficient.

Example: In the 8085, interrupts like TRAP, RST 5.5, RST 6.5, RST 7.5 are vectored interrupts because each one has a fixed call address in memory.

In contrast, a non-vectored interrupt (like INTR) does not provide the address directly; the processor must determine the ISR address through external hardware.


Interrupts in 8085 Microprocessor

The 8085 has 5 hardware interrupt pins:

InterruptType
TRAPNon-Maskable
RST 7.5Maskable
RST 6.5Maskable
RST 5.5Maskable
INTRMaskable

1. Maskable Interrupts

  • A maskable interrupt is one that can be enabled or disabled (masked) by the programmer using software instructions.
  • In 8085, the EI (Enable Interrupt) and DI (Disable Interrupt) instructions are used to enable or disable maskable interrupts.
  • When the processor is busy with a critical task, it can ignore (mask) these interrupts temporarily.
  • The response to a maskable interrupt can be immediate or delayed.

Maskable interrupts in 8085:

  • INTR - General purpose maskable interrupt; requires external hardware to supply the restart address.
  • RST 5.5 - Vectored; calls address 002CH
  • RST 6.5 - Vectored; calls address 0034H
  • RST 7.5 - Vectored; calls address 003CH (highest priority among maskable)

These can also be individually masked using the SIM (Set Interrupt Mask) instruction.


2. Non-Maskable Interrupt

  • A non-maskable interrupt is one that cannot be disabled or ignored by the programmer. The processor must respond to it immediately regardless of the state of the interrupt enable flag.
  • It is used for emergency or critical situations such as power failure.

Non-maskable interrupt in 8085:

  • TRAP - It is the only non-maskable interrupt in 8085.
    • It has the highest priority among all interrupts.
    • It is both edge-triggered and level-triggered (making it very reliable).
    • It calls the fixed address 0024H.
    • It cannot be masked by EI/DI instructions or SIM instruction.

Summary Table

FeatureMaskable InterruptNon-Maskable Interrupt
Can be disabled?Yes (using DI / SIM)No
Example in 8085INTR, RST 5.5, RST 6.5, RST 7.5TRAP
PriorityLowerHighest
Use caseGeneral I/O requestsCritical emergencies
Open this answer on its own page →

2078 · 5 marks

Write short notes on (any two):a. Program Counter b. Von-Neumann Architecture c. Interrupt Masking [5]

--- The Program Counter (PC) is a 16-bit special-purpose register in the 8085 microprocessor. It is one of the most important registers in the CPU and plays a central role in program execution. - The PC holds the memory address of the next instruction to be fetched and executed. - During the fetc...

Open this answer on its own page →

2080.1 · 5 marks

What is the significance of interrupt masking? Difference between vectored and polled interrupt. [5]

--- Interrupt masking is the ability of the processor to enable or disable (mask) certain interrupts so that the CPU can decide whether to respond to an interrupt immediately or delay its response. Key significance: - Maskable Interrupts: These interrupts can be enabled or disabled by the program...

Open this answer on its own page →

Direct Memory Access

2080 · 5 marks

What do you mean by Isolated I/O? Explain basic DMA operation in brief. [5]

--- Isolated I/O (also called I/O-mapped I/O) is a method of connecting I/O devices to the system where the I/O devices have a separate address space from the memory address space. - The CPU uses dedicated I/O instructions (such as IN and OUT) to communicate with I/O devices, which are distinct f...

Open this answer on its own page →

2079 · 5 marks

Write short notes on (Any TWO):a. LDT b. DMA c. Assemble directives [5]

--- LDT is a memory management structure used in protected mode of x86 processors (such as the 8086/80286 and above). - In protected mode, memory is managed using descriptors -- entries that define the base address, size (limit), and access rights of a memory segment. - The LDT is a table that ho...

Open this answer on its own page →

2078 · 5 marks

Differentiate between interrupt based I/O and DMA based I/O. Explain based DMA operation in brief. [5]

Aspect Interrupt Based I/O DMA Based I/O --------- CPU Involvement CPU is interrupted and handles each data transfer CPU is minimally involved; DMA controller handles transfer Data Transfer Data passes through CPU registers Data transfers directly between memory and I/O device Speed Slower; CPU o...

Open this answer on its own page →

2076 · 10 marks

Describe the working mechanism of DMA. Draw the internal architecture of the 8237 DMAC along with a timing diagram illustrating the process of DMA transfers.[10]

Direct Memory Access (DMA) is a technique that allows peripheral devices (such as disk drives, network cards, etc.) to transfer data directly to/from main memory without involving the CPU for each byte of data transfer. This significantly improves system performance by freeing the CPU to perform ...

Open this answer on its own page →

2080.1 · 5 marks

What is the importance of direct memory access? Explain the mechanism of direct memory access. [5]

Show solved answer

Direct Memory Access (DMA) - Importance and Mechanism

Importance of Direct Memory Access

Direct Memory Access (DMA) is a technique that allows external I/O devices to communicate directly with the memory without involving the processor every time. Its importance includes:

  1. Frees the CPU: The CPU does not need to supervise every data transfer between I/O devices and memory, allowing it to perform other tasks simultaneously.
  2. High Speed Data Transfer: Large blocks of data can be transferred at high speed directly between memory and peripherals (e.g., disk drives, network cards) without CPU intervention.
  3. Reduced CPU Overhead: Since the CPU is not busy handling each byte of data transfer, overall system performance and efficiency is greatly improved.
  4. Efficient Use of System Resources: The processor and I/O operations can proceed in parallel, making better use of available hardware resources.
  5. Essential for High-Bandwidth Devices: Devices such as hard disks, graphics cards, and sound cards require fast bulk data transfers that would be too slow if handled byte-by-byte by the CPU.

Mechanism of Direct Memory Access

The DMA mechanism works through a dedicated hardware unit called the DMA Controller (DMAC). The steps involved are as follows:

Step 1: DMA Request

  • When an I/O device needs to transfer data to/from memory, it sends a DMA request signal to the DMA controller.

Step 2: HOLD Signal to CPU

  • The DMA controller activates the HOLD pin of the microprocessor.
  • This signals the CPU to relinquish (release) control of the system buses (address bus, data bus, and control bus).

Step 3: HLDA (Hold Acknowledge)

  • The CPU completes its current bus cycle and then sends a Hold Acknowledge (HLDA) signal back to the DMA controller.
  • The CPU now enters a hold state and stops using the buses.

Step 4: DMA Takes Control of Buses

  • The DMA controller now takes control of:
    • Address Bus - to specify memory locations
    • Data Bus - to transfer data
    • Control Bus - to generate read/write signals

Step 5: Data Transfer

  • The DMA controller directly transfers data between the I/O device and memory without CPU involvement.
  • This transfer can be:
    • Byte by byte (cycle stealing mode)
    • Block transfer (burst mode)

Step 6: Release of Buses

  • After the data transfer is complete, the DMA controller deactivates the HOLD signal.
  • The CPU regains control of the buses and resumes normal operation.

DMA Transfer Diagram

I/O Device  ---[DMA Request]---> DMA Controller
                                      |
                               [HOLD Signal]
                                      |
                               Microprocessor
                                      |
                              [HLDA - Acknowledge]
                                      |
DMA Controller takes Address, Data, Control Buses
                                      |
         Direct Transfer: I/O Device <-----> Memory
                                      |
                         DMA releases buses
                                      |
                         CPU resumes operation

Summary

DMA is important because it enables fast, CPU-independent data transfer between memory and peripherals. The mechanism relies on the HOLD and HLDA handshake between the DMA controller and the CPU, after which the DMA controller directly manages the buses to perform the transfer efficiently.

Open this answer on its own page →

Interrupt

2080 · 5 marks

Write short notes on:a. RS-232 b. Interrupts [5]

--- RS-232 (Recommended Standard 232) is a standard for serial communication transmission of data between a Data Terminal Equipment (DTE) and Data Communication Equipment (DCE). It is one of the most widely used serial communication interfaces in computers and microprocessor-based systems. - RS-2...

Open this answer on its own page →

Memory Read

2079 · 5 marks

Explain memory read operation with suitable figure. [5]

A memory read operation is the process by which the microprocessor retrieves (reads) data stored at a specific memory location and brings it into the processor for further processing. This operation involves coordinated use of the address bus, data bus, and control bus. --- Bus Role in Read Opera...

Open this answer on its own page →