Menu Close

Memory and I/O interfacing: UPSC Electrical Engineering Optional PYQ Solutions (2004–2026)

All 25 questions UPSC has asked on memory and I/O interfacing in the Electrical Engineering Optional (Paper II, Microprocessors and Microcomputers) from 2004 to 2026, solved step by step – latest first.

Try them yourself first: the same questions, without solutions, are on our Microprocessors and Microcomputers topic-wise PYQs page. Circuit diagrams have been redrawn from the question papers.

How we check these solutions

These are our own solutions, prepared with AI help. UPSC does not publish official answers. Every solution is checked a second way before it goes up, and says how:

  • ✓ Checked by computer the numbers were worked out again independently in code (SymPy and NumPy: circuit equations, power balance, matrices, integrals).
  • ✓ Answer checked step by step for theory and descriptive questions, every point was checked against the standard theory.

Where a printed question is wrong, unclear or incomplete, we say so and solve the intended version.

Spotted a mistake or a neater method? Tell us in the comments below or through Report an error.

Jump to a question (year · question number):

2026 · 4b(i) 2026 · 4b(ii) 2024 · 2b(i) 2024 · 2b(ii) 2023 · 3b(i) 2023 · 6b(i) 2022 · 3c 2021 · 8b 2019 · 2b 2019 · 6c 2018 · 1e 2017 · 1c(ii) 2017 · 2b 2016 · 1c 2015 · 3c 2013 · 6b(i) 2012 · 6b 2011 · 1c(i) 2011 · 6b(i) 2011 · 7b(i) 2010 · 7b 2007 · 7a 2005 · 4a 2005 · 200w/5a 2004 · 200w/5a

Cover of the UPSC Prelims Topic-wise PYQ book with detailed explanations

From the Optional Province team

Preparing for Prelims too?

Our UPSC Prelims Topic-wise PYQ Book covers every Prelims question with detailed explanations, so you can see exactly where UPSC asks from. Now available as a hard copy and an eBook.

Buy Hard Copy on AmazonBuy eBook (PDF)

Download a free sample

Write an assembly language program for the 8253/8254 (programmable interval timer) to operate in mode 3 and mode 2. Use counter 0 for which control word register address is 2DH and counter 0 address is 2BH. Input clock is 1 MHz and output frequency is 1 kHz.

2026 · Paper II · Q4b(i) · 10 marks

Solution

Count. N=finfout=1MHz1kHz=1000=03E8H This is loaded LSB first, then MSB.

Control word (format SC1 SC0 · RW1 RW0 · M2 M1 M0 · BCD)

  • Mode 3 (square wave): counter 0 = 00, LSB then MSB = 11, mode 011, binary 0. This gives 0011 0110 = 36H.
  • Mode 2 (rate generator): mode 010 gives 0011 0100 = 34H.

Program, mode 3 (1 kHz square wave on OUT0)

Instruction Comment
MVI A, 36H counter 0, LSB/MSB, mode 3, binary
OUT 2DH control word register
MVI A, E8H low byte of 1000
OUT 2BH counter 0
MVI A, 03H high byte
OUT 2BH counter 0 starts counting
HLT

Program, mode 2 (1 kHz rate generator: one low pulse of one clock period every 1 ms)

Instruction Comment
MVI A, 34H counter 0, LSB/MSB, mode 2, binary
OUT 2DH
MVI A, E8H
OUT 2BH
MVI A, 03H
OUT 2BH
HLT

GATE0 must be held high. In mode 3, OUT0 is high for 500 counts and low for 500 (a 50 % duty, 1 kHz square wave). In mode 2, OUT0 stays high and goes low for 1 µs every 1000 counts.

(With BCD counting, the control words are 37H and 35H, and the count is 1000 written as 00H then 10H.)

✓ Checked by computer We worked out the count and both control words bit by bit in Python.

↑ Back to the question list

Design a hardware scheme to interface 8255 (programmable peripheral interface) with 8085, and configure its Port ‘A’ and Port ‘C’ as input ports and Port ‘B’ as output port. Write an assembly language program to take two different numbers from Port ‘A’ and Port ‘C’ and display the summation of these numbers on Port ‘B’ as output. Assume the port addresses are: Port A = 00H Port B = 01H Port C = 02H Control word register address: 03H.

2026 · Paper II · Q4b(ii) · 10 marks

Solution

Hardware scheme

8085AD7–AD0ALEA7–A0 (latched)IOR, IOWRESET OUT74LS373latch (ALE)DecoderA7–A2 = 0000008255AD7–D0A1, A0CSRD, WRRESETPort A (00H)input number 1Port B (01H)output (sum)Port C (02H)input number 2A1 A0CSD7–D0IOR, IOW → RD, WRRESET OUT → RESETControl word 99H at 03H
A1, A0 select the port; A7–A2 are decoded for chip select. On a phone, swipe sideways to see all of it.
  • AD7–AD0 are demultiplexed with a 74LS373 latch, using ALE.
  • Address lines A7–A2 = 000000 are decoded to give CS of the 8255, so the 8255 occupies 00H–03H. A1 and A0 select the port or control register.
  • IOR and IOW (from IO/M, RD and WR) drive RD and WR. RESET OUT drives RESET.

Control word (mode 0: port A in, port C upper and lower in, port B out) 10011001=99H (D7 = 1 I/O mode; D6 D5 = 00 mode 0; D4 = 1 A in; D3 = 1 C upper in; D2 = 0; D1 = 0 B out; D0 = 1 C lower in.)

Program

Instruction Comment
MVI A, 99H control word
OUT 03H configure the 8255
IN 00H first number from port A
MOV B, A save it
IN 02H second number from port C
ADD B sum
OUT 01H display the sum on port B
HLT

Check. With 25H at port A and 37H at port C, port B shows 5CH. A carry out of an 8-bit sum is lost. If needed, it can be shown on a spare LED by testing CY.

✓ Checked by computer We ran the program on an 8085 simulator in Python and checked the control word bit by bit.

↑ Back to the question list

Compare I/O mapped I/O and memory mapped I/O interfacing techniques used in 8085 microprocessor.

2024 · Paper II · Q2b(i) · 10 marks

Solution

Feature I/O-mapped I/O (peripheral-mapped) Memory-mapped I/O
Address 8-bit port address (00H–FFH) 16-bit address, like a memory location
Number of ports 256 input + 256 output Up to 64 K (shared with memory)
Instructions Only IN and OUT (data through A) All memory instructions: MOV r, M, LDA, STA, ADD M, ANA M …
Control signals IOR, IOW (IO/M = 1) MEMR, MEMW (IO/M = 0)
Decoding Only 8 address lines, so simpler and cheaper 16 lines to decode, more hardware
Memory space All 64 K is left for memory Ports use up part of the memory map
Data transfer Only between the port and the accumulator Between the port and any register, or by arithmetic and logic directly
Speed of instruction IN, OUT: 10 T-states MOV r, M: 7 T; LDA, STA: 13 T
Separation I/O and memory clearly separated, which is safer Accidental memory writes can disturb I/O

Summary. I/O-mapped I/O is preferred in small systems with few ports, because decoding is simple and the whole memory map stays free. Memory-mapped I/O is chosen when many ports are needed or when powerful memory instructions should work directly on port data.

✓ Answer checked step by step Standard result.

↑ Back to the question list

What are the operating modes of Port-A of 8255? Explain handshake operation in I/O ports.

2024 · Paper II · Q2b(ii) · 10 marks

Solution

Operating modes of port A of the 8255A

  • Mode 0: simple (basic) I/O. Port A is latched output or buffered input, with no handshake. The direction is fixed by the control word.
  • Mode 1: strobed (handshake) I/O. Port A is input or output, and three lines of port C become its handshake and interrupt signals:
    • input: PC4 = STBA, PC5 = IBFA, PC3 = INTRA;
    • output: PC7 = OBFA, PC6 = ACKA, PC3 = INTRA.
  • Mode 2: bidirectional handshake. Only port A can do this. PC3–PC7 are used: STB, IBF, OBF, ACK, INTR.

(Port B has modes 0 and 1 only.)

Handshake operation. A handshake synchronises the processor and a peripheral that work at different speeds. Each side signals when data is ready and when it has been taken, so no data is lost or read twice.

Input handshake (mode 1):

  1. The device places data on PA7–PA0 and pulses STB low. The 8255 latches the data.
  2. The 8255 sets IBF (input buffer full) high. This tells the device not to send more, and, if enabled, it raises INTR to interrupt the CPU.
  3. The CPU reads port A (RD). This clears INTR, and IBF goes low, so the device may send the next byte.

Output handshake (mode 1):

  1. The CPU writes to port A (WR). The 8255 makes OBF (output buffer full) low, telling the device that data is ready.
  2. The device takes the data and pulses ACK low. OBF goes high, and INTR goes high to ask the CPU for the next byte.

The status of IBF and OBF can also be read from port C, for polled (status-check) transfer instead of interrupts.

✓ Answer checked step by step Standard result.

↑ Back to the question list

Differentiate between full decoding and partial decoding techniques used by 8085 microprocessor to decode an address. Give advantages and disadvantages of each technique.

2023 · Paper II · Q3b(i) · 10 marks

Solution

Full (absolute) decoding. All the address lines not used inside the chip are decoded to produce its chip-select. Each memory location or port then has one unique address.

Example: a 2 K × 8 EPROM uses A10–A0 internally. A15–A11 all go to the decoder, so the chip occupies exactly 0000H–07FFH.

Partial (linear) decoding. Only some of the higher address lines are decoded; the rest are ignored (“don’t care”). Each location then appears at several addresses (foldback or mirror addresses).

Example: if only A15 is used as the chip-select of the 2 K chip, it responds to any address with A15 = 0. The same 2 K block repeats 16 times in 0000H–7FFFH.

Full decoding Partial decoding
Advantages Unique addresses; no address space wasted; memory can be expanded freely without conflicts Fewer gates and a simpler, cheaper decoder; less delay through the decoder
Disadvantages More decoding hardware (more gates, larger decoder), slightly more propagation delay and cost Foldback addresses waste memory space; later expansion is limited; a program using a “mirror” address may clash with another device
Use Large systems, when memory and I/O will grow Small dedicated systems with few chips (single-board controllers)

✓ Answer checked step by step Standard result.

↑ Back to the question list

Write the steps involved in DMA data transfer. Also describe the functions of 8085 pins which are used in DMA data transfer.

2023 · Paper II · Q6b(i) · 12 marks

Solution

DMA (direct memory access). Data moves directly between a fast I/O device and memory, without passing through the CPU registers. A DMA controller (such as the 8257 or 8237) takes control of the buses.

8085HOLD ←HLDA →DMA controlleraddress & countregistersMEMR, MEMW,IOR, IOWMemoryI/O device(disk, ADC…)System address / data / control busesHOLDHLDADRQDACK
DRQ/DACK with the device; HOLD/HLDA with the CPU. On a phone, swipe sideways to see all of it.

Steps in a DMA transfer

  1. Programming. The CPU first programs the DMA controller with the starting memory address, the byte count, and the mode (read, write or verify; single or block).
  2. Request. The I/O device that is ready requests service by raising DRQ to the DMA controller.
  3. Bus request. The DMA controller asks the CPU for the buses by raising HOLD.
  4. Grant. The 8085 completes the current machine cycle, floats its address, data and control lines (tri-state), and answers with HLDA.
  5. Acknowledge. The DMA controller sends DACK to the device, places the memory address on the address bus, and issues MEMR/IOW (memory to I/O) or IOR/MEMW (I/O to memory). Each byte moves directly in one bus cycle. The controller increments the address and decrements the count.
  6. Completion. When the count reaches zero (TC, terminal count), or DRQ is removed, the controller drops HOLD. The 8085 then lowers HLDA and takes back the buses.

8085 pins used in DMA

  • HOLD (input). A request from the DMA controller for the buses. It is sampled in each machine cycle; the 8085 completes the current machine cycle first, so the response comes within one machine cycle.
  • HLDA (output). Hold acknowledge. It goes high one clock cycle after the bus is released, meaning that the address/data bus, RD, WR, IO/M and ALE are now tri-stated. It goes low after HOLD is removed, and the CPU then resumes.
  • The tri-state bus lines (A15–A8, AD7–AD0, RD, WR, IO/M) are floated during the hold so that the DMA controller can drive them. ALE is also floated.
  • READY can be used by slow devices during DMA.

✓ Answer checked step by step Standard result.

↑ Back to the question list

(i) Explain the use of MAR in interfacing the external memory to processor. (ii) Name various 8-bit and 16-bit internal registers in microprocessor 8085 and also, indicate which 8-bit registers can be paired to act as 16-bit register in several instructions.

2022 · Paper II · Q3c · 10 marks

Solution

(i) MAR in memory interfacing

The memory address register (MAR) holds the address of the memory location being accessed, so that the address stays stable on the address bus for the whole read or write cycle.

In the 8085, this role is played by the address latch and buffers. The lower byte comes out on the multiplexed AD7–AD0 lines only in T1. So an external latch (such as the 74LS373), strobed by ALE, captures A7–A0, while A15–A8 come from the address buffer. Together they act as the MAR for the memory chips.

  • The memory decodes the MAR contents (chip select from the high-order bits; the word inside the chip from the low-order bits).
  • Data then moves through the data buffer (the memory buffer register, MBR).
  • Without this latch, the memory would lose the low-order address when AD7–AD0 switch over to carrying data in T2.

(ii) Registers of the 8085

  • 8-bit registers:
    • accumulator A;
    • general-purpose registers B, C, D, E, H, L;
    • flag register F (S, Z, AC, P, CY);
    • instruction register and temporary register (not accessible to the programmer).
  • 16-bit registers: program counter (PC), stack pointer (SP), and the incrementer/decrementer address latch.
  • Register pairs that act as 16-bit registers in instructions such as LXI, INX, DCX, DAD, PUSH and POP:
    • BC (B high, C low);
    • DE (D high, E low);
    • HL (H high, L low). HL is also the memory pointer M.
  • PSW = A + flags, used with PUSH PSW and POP PSW.

✓ Answer checked step by step Standard result.

↑ Back to the question list

A commercial interface unit uses different names for the handshake lines associated with the transfer of data from the I/O device into the interface unit. The interface input handshake line is labelled STB (strobe), and the interface output handshake line is labelled IBF (input buffer full). A low-level signal on STB loads data from the I/O bus into the interface data register. A high-level signal on IBF indicates that the data item has been accepted by the interface. IBF goes low after an I/O read signal from the CPU when it reads the content of the data register. (i) Draw the block diagram showing the CPU, the interface, and the I/O device together with the pertinent interconnections among the three units. (ii) Draw a timing diagram for the handshaking transfer. (iii) Obtain a sequence of events flowchart for the transfer from the device to the interface and from the interface to the CPU.

2021 · Paper II · Q8b · 20 marks

Solution

(i) Block diagram

CPUdata busI/O readaddressInterfacedata registerstatus (IBF)I/O devicedataI/O readselectI/O bus dataSTBIBFIBF may also go to the CPU as a status bit or interrupt
Handshake lines STB and IBF. On a phone, swipe sideways to see all of it.
  • CPU to interface: the data bus, an address or select line (chip select and register select), and the I/O read control line. IBF may also be read by the CPU as a status bit, or used as an interrupt request.
  • Interface to I/O device: the I/O data bus into the data register, the strobe STB from the device, and IBF back to the device.

(ii) Timing diagram

I/O busvalid dataSTBIBFI/O readloadbuffer fullread
STB loads the data; IBF stays high until the CPU reads. On a phone, swipe sideways to see all of it.
  1. The device puts valid data on the I/O bus.
  2. A low level on STB loads the data into the interface data register.
  3. When the register has accepted the data, the interface raises IBF (input buffer full).
  4. The CPU later performs an I/O read of the data register. At the end of the read, IBF goes low, so the device may send the next item.

(iii) Sequence of events

I/O deviceInterface and CPUDevice: place data on I/O busDevice: pulse STB lowDevice: wait for IBF = 0(next data item)Interface: load register on STBInterface: set IBF = 1CPU: IBF = 1? (poll / interrupt)CPU: I/O read of registerInterface: clear IBF = 0IBF = 0
Device steps on the left; interface and CPU steps on the right. On a phone, swipe sideways to see all of it.

Device to interface: the device places data on the I/O bus, then waits until IBF = 0 (the register is free), then pulses STB low. The interface loads the register and sets IBF = 1. The device sees IBF = 1 and knows the data has been accepted. It may remove the data and prepare the next item, but must wait for IBF = 0 before strobing again.

Interface to CPU: the CPU checks IBF, either by polling a status register or because IBF raised an interrupt. When IBF = 1, it reads the data register with an I/O read. The interface then clears IBF = 0, which allows the next transfer.

This two-wire handshake guarantees that a new item is never loaded before the CPU has read the previous one, and that the CPU never reads the same item twice.

✓ Answer checked step by step Standard result.

↑ Back to the question list

Design an output port with address FFH to interface the 1408 D/A converter that is calibrated for a 0 to 10 V range (with the use of 8085 microprocessor). Write a program to generate a continuous ramp waveform. The pin diagrams of an octal latch (74LS373) and the 1408 D/A converter are provided for reference:

74LS37320VCC198Q188D177D167Q156Q146D135D125Q11LE1OE21Q31D42D52Q63Q73D84D94Q10GND1408 DAC16Comp15−Vref14+Vref13VCC12A811A710A69A51Range2GND3VEE4Io5A16A27A38A4
Figure redrawn from the question paper. On a phone, swipe sideways to see all of it.

2019 · Paper II · Q2b · 20 marks

Solution

Output port FFH

  • Port FFH means A7–A0 (also repeated on A15–A8 in the I/O cycle) are all 1. An 8-input NAND gives Y = 0 only for address FFH.
  • Y and IOW go into a NOR gate. Its output is high only when both are low, that is, during OUT FFH.
  • This high pulse drives LE of the 74LS373 latch, which is transparent when LE = 1 and latches on the falling edge. OE is grounded, so the latch outputs always drive the DAC.
  • The latch inputs 1D–8D take D0–D7 from the data bus. The outputs go to the 1408 inputs, with D7 → A1 (MSB) … D0 → A8 (LSB): in the 1408, A1 is the most significant bit.
  • The 1408 current output (pin 4) feeds an op-amp current-to-voltage converter. With Vref and the feedback resistor set for 0 to 10 V full scale, one step is 10/256 = 39.1 mV. The output ranges from 0 (00H) to 9.96 V (FFH).
8085A7–A0IOWD7–D08-inputNANDNOR74LS373D → QLEOE = GND1408 DACA1 (MSB)…A8Op-ampI → V, 0–10 VYLE (high = load)D7…D0Q7…Q0I_oD7 → A1 (MSB) … D0 → A8 (LSB)
A typical schematic; resistor values set the 0–10 V range. On a phone, swipe sideways to see all of it.

Program: continuous ramp

Instruction T-states Comment
MVI A, 00H 7 start at 0 V
LOOP: OUT FFH 10 send A to the DAC
INR A 4 next step (FFH rolls over to 00H)
JMP LOOP 10 repeat forever

Each step takes 24 T-states, 8 µs at 3 MHz. One ramp (256 steps) takes about 2.05 ms, so the sawtooth repeats at about 488 Hz. A delay loop after OUT makes the ramp slower.

02.054.106.14510t (ms)V
256 steps of 39 mV, 8 µs each at 3 MHz. On a phone, swipe sideways to see all of it.

✓ Checked by computer We checked the address decoding, the ramp program and its step size in Python.

↑ Back to the question list

What is the format of the control word of 8255 programmable peripheral interface? Explain the significance of each bit of the control word.

2019 · Paper II · Q6c · 10 marks

Solution

The control register of the 8255A is written at the address with A1 A0 = 11. Bit D7 decides the meaning of the word.

I/O mode set word (D7 = 1)

D71 = I/O modeD6Group AD5modeD4Port AD3Port C(U)D2Group B modeD1Port BD0Port C(L)D6 D5: 00 = mode 0, 01 = mode 1, 1x = mode 2 · D2: 0 = mode 0, 1 = mode 1D4, D3, D1, D0: 1 = input, 0 = output(D7 = 0 gives the bit set/reset word for port C: D3–D1 select the bit, D0 = 1 sets, 0 resets)
D7 is the leftmost bit. On a phone, swipe sideways to see all of it.
Bit Significance
D7 1 = mode set (I/O) control word
D6, D5 Mode of group A (port A and port C upper): 00 = mode 0, 01 = mode 1, 1× = mode 2
D4 Port A: 1 = input, 0 = output
D3 Port C upper (PC7–PC4): 1 = input, 0 = output
D2 Mode of group B (port B and port C lower): 0 = mode 0, 1 = mode 1
D1 Port B: 1 = input, 0 = output
D0 Port C lower (PC3–PC0): 1 = input, 0 = output

Example: 80H makes all ports outputs in mode 0; 9BH makes all ports inputs in mode 0.

Bit set/reset (BSR) word (D7 = 0). This sets or resets one bit of port C individually:

  • D6–D4: not used (0);
  • D3 D2 D1: bit select (000 = PC0 … 111 = PC7);
  • D0: 1 = set, 0 = reset.

For example, 0FH sets PC7, and 0EH resets it. BSR words do not disturb the I/O mode already set.

✓ Answer checked step by step Standard result.

↑ Back to the question list

Draw the schematic diagram for interfacing an 8-bit analog to digital converter to 8085 microprocessor using 8255 PPI.

2018 · Paper II · Q1e · 10 marks

Solution

8085data, address,control buses8255APort A (in)PC4 (in)PC0 (out)CW 98H8-bit ADCD7–D0EOCSOC / ALECLK, VrefAnaloginput(S/H)dataEOCSOC
Port A reads data; PC0 starts conversion; PC4 reads end of conversion. On a phone, swipe sideways to see all of it.

Connections

  • The 8255A is decoded as an I/O device (for example at 80H–83H) on the 8085 buses.
  • Port A (input) ← ADC data outputs D7–D0.
  • PC0 (output) → SOC (start of conversion; also ALE for an 0808).
  • PC4 (input) ← EOC (end of conversion).
  • The ADC gets its clock (or uses its RC clock), Vref, and the analog input through a sample-and-hold if the signal changes quickly.

Control word: port A in, port C upper in, port C lower out, mode 0: 10011000=98H

Program (polled)

Instruction Comment
MVI A, 98H configure the 8255
OUT 83H
MVI A, 01H PC0 = 1
OUT 82H start pulse…
MVI A, 00H
OUT 82H …SOC back to 0: conversion starts
WAIT: IN 82H read port C
ANI 10H test PC4 (EOC)
JZ WAIT wait until EOC = 1
IN 80H read the digital value from port A

The BSR words (01H/00H to 83H) can also be used to pulse PC0 without affecting the other port C bits. EOC can instead be wired to RST 7.5 so that the conversion is serviced by interrupt.

✓ Answer checked step by step Standard result (typical ADC 0804/0808 interface).

↑ Back to the question list

Calculate the number of memory chips needed to design 8k-bytes memory for an 8085 microprocessor. The memory chip size is 1024×1.

2017 · Paper II · Q1c(ii) · 5 marks

Solution

Required=8K×8bits=8192×8=65536bits Chip=1024×1=1024bits N=8192×81024×1=64chips

Organisation

  • Width: 8 chips side by side make one 1 K × 8 bank (one chip per data bit).
  • Depth: 8 such banks make 8 K.

So the arrangement is 8 rows × 8 columns.

The 10 address lines A9–A0 go to every chip. A12–A10 go to a 3-to-8 decoder that selects one of the 8 banks, and the remaining lines (A15–A13) are decoded for the base address.

✓ Checked by computer We computed the chip count in Python.

↑ Back to the question list

Cover of the UPSC Mains Topic-wise and Year-wise PYQs book (2013–2026)

From the Optional Province team

Strengthen your GS papers

Our UPSC Mains Topic-wise & Year-wise PYQ Book (2013–2026) maps every GS question to the syllabus, so you know what UPSC asks and how often. Now available as a hard copy and an eBook.

Buy Hard Copy on AmazonBuy eBook (PDF)

Download a free sample

What is the difference between cycle stealing DMA and interleaved DMA in 8085 microprocessor? What is meant by block transfer DMA?

2017 · Paper II · Q2b · 15 marks

Solution

  • Cycle-stealing DMA. The DMA controller takes the bus for one bus cycle at a time (one byte or word). It “steals” that cycle from the CPU, which is held off (HOLD/HLDA) for just that cycle. Then the bus is returned, the CPU continues, and the next byte steals another cycle. The CPU slows down slightly but keeps working. This suits devices that deliver data at a moderate rate.
  • Interleaved (transparent) DMA. The DMA transfer uses only bus cycles in which the CPU does not need the bus: for example the internal decode/execute T-states (T4 of an opcode fetch, the bus-idle cycles), or the half of the clock in which the CPU is not using memory. The CPU is never stopped, so DMA is “transparent” to it. But this needs extra timing logic, and the transfer rate is limited by the free slots.
  • Block-transfer (burst) DMA. On a single request, the DMA controller keeps the buses (HOLD stays high) and transfers a whole block of data, byte after byte, until the count is exhausted (terminal count) or the device stops. Only then is the bus returned. This gives the highest transfer rate, as for disk or high-speed ADC buffers, but the CPU is idle for the whole block.

✓ Answer checked step by step Standard result.

↑ Back to the question list

Compare memory mapped I/O (Input/Output) with peripheral mapped I/O for 8085 microprocessor.

2016 · Paper II · Q1c · 10 marks

Solution

Feature Memory-mapped I/O Peripheral (I/O)-mapped I/O
Device address 16-bit, part of the memory map 8-bit port address, separate I/O space
Maximum devices Up to 64 K locations (shared with memory) 256 input and 256 output ports
Instructions Any memory-reference instruction: LDA, STA, MOV r, M, ADD M, ANA M, INR M … Only IN port and OUT port
Data path Any register, and arithmetic or logic directly on port data Accumulator only
Control signals MEMR / MEMW (IO/M = 0) IOR / IOW (IO/M = 1)
Address decoding 16 lines: more hardware 8 lines: simpler
Memory available Reduced by the space given to I/O Full 64 K for memory
Execution time MOV r, M 7 T; LDA 13 T IN, OUT 10 T

Example. A port at 8000H (memory-mapped) is read with LDA 8000H or MOV A, M (HL = 8000H). A port at 80H (I/O-mapped) is read with IN 80H.

✓ Answer checked step by step Standard result.

↑ Back to the question list

What is 8255A PPI? Discuss its blocks—output ports and control logic. Write the instructions to load 65 H in register C and 92 H in accumulator A. Display the number of 65 H and 92 H at PORT 0 and PORT 1 respectively.

2015 · Paper II · Q3c · 10 marks

Solution

8255A PPI. A programmable peripheral interface: a general-purpose, programmable parallel I/O chip with three 8-bit ports (A, B, C), 24 I/O lines in all. Port C can be used as two 4-bit ports, or as handshake lines. The function of each port is set by a control word written by the CPU.

Internal data bus (8 bits)Data bus bufferD7–D0 ↔ system busRead/writecontrol logicRD, WRA1, A0RESETCSGroup AcontrolGroup BcontrolPort A (8)Port C upper (4)Port C lower (4)Port B (8)PA7–PA0PC7–PC4PC3–PC0PB7–PB0(every port and the control logic connect to the internal bus)
Internal organisation of the 8255A. On a phone, swipe sideways to see all of it.

Blocks

  • Data bus buffer. A tri-state, bidirectional 8-bit buffer joining the internal bus to the system data bus.
  • Read/write control logic. Uses CS, RD, WR, A1, A0 and RESET to select a port or the control register, and the direction of transfer.
  • Group A control (port A + port C upper) and group B control (port B + port C lower). These receive the control word and configure their ports: mode 0, 1, 2 for A; mode 0, 1 for B; and input or output.
  • Output ports. Port A (8-bit, latched output / buffered input), port B (8-bit), and port C (two 4-bit halves; individual bits can be set or reset with BSR words). An output port latches the data written by the CPU and holds it for the device.

Program. We take PORT 0 = port A at 00H, PORT 1 = port B at 01H, and the control register at 03H.

Instruction Comment
MVI A, 80H all ports output, mode 0
OUT 03H control register
MVI C, 65H load 65H in C
MVI A, 92H load 92H in A
OUT 01H 92H displayed at PORT 1
MOV A, C
OUT 00H 65H displayed at PORT 0
HLT

✓ Answer checked step by step Standard result (port addresses assumed).

↑ Back to the question list

Show how DAC 1200 can be interfaced to the 8255. Write the schematic diagram. Use ‘double buffering’ to prevent glitches.

2013 · Paper II · Q6b(i) · 14 marks

Solution

Why double buffering? A 12-bit DAC must receive all 12 bits at the same time. The 8255 has 8-bit ports, so the data is written in two parts (8 bits, then 4 bits). If the DAC inputs followed the ports directly, then between the two writes the DAC would see a mixture of new low bits and old high bits. For an instant it would output a wrong value: a glitch.

Scheme

8255APort A (8)Port B (PB3–PB0)PC0 strobeLatch 1low 8 bitsLatch 2high 4 bitsSecond-ranklatch (12 bits)loaded togetherDAC120012-bit→ op-ampPC0 pulse → output changes once(PC1, PC2 can strobe latches 1 and 2 if they are not transparent)
Two ranks of latches; one strobe updates all 12 bits. On a phone, swipe sideways to see all of it.
  1. First rank. Port A → latch 1 (low 8 bits D7–D0). PB3–PB0 → latch 2 (high 4 bits D11–D8). (Port outputs are themselves latched, so these may simply be the 8255 port latches.)
  2. Second rank. A 12-bit latch (for example two 74LS374) between the first rank and the DAC1200. It is clocked only by a strobe from PC0.
  3. The DAC1200 output current goes to an op-amp current-to-voltage converter.

Program sequence (control word 80H, all ports output):

  1. MOV A, low then OUT PORTA: load the low 8 bits.
  2. MOV A, high then OUT PORTB: load the high 4 bits.
  3. Pulse PC0 (BSR words 01H, then 00H): the second-rank latch loads all 12 bits together.

So the DAC input changes once, from the old 12-bit word to the new one. There is no intermediate code, and no glitch.

✓ Answer checked step by step Standard result.

↑ Back to the question list

Draw a block schematic of an 8255-programmable parallel I/O device, showing all elements and control word format. For mode 0 (simple input and output), determine the addresses of its ports and of the control register. Write a control word in the control register, when port A = output, port CU = output, port B = input and port CL = input.

2012 · Paper II · Q6b · 20 marks

Solution

Block schematic and control word format

Internal data bus (8 bits)Data bus bufferD7–D0 ↔ system busRead/writecontrol logicRD, WRA1, A0RESETCSGroup AcontrolGroup BcontrolPort A (8)Port C upper (4)Port C lower (4)Port B (8)PA7–PA0PC7–PC4PC3–PC0PB7–PB0(every port and the control logic connect to the internal bus)
Internal organisation of the 8255A. On a phone, swipe sideways to see all of it.
D71 = I/O modeD6Group AD5modeD4Port AD3Port C(U)D2Group B modeD1Port BD0Port C(L)D6 D5: 00 = mode 0, 01 = mode 1, 1x = mode 2 · D2: 0 = mode 0, 1 = mode 1D4, D3, D1, D0: 1 = input, 0 = output(D7 = 0 gives the bit set/reset word for port C: D3–D1 select the bit, D0 = 1 sets, 0 resets)
D7 is the leftmost bit. On a phone, swipe sideways to see all of it.

Port addresses (mode 0). The 8255 uses A1 and A0 to select a register, so it occupies 4 consecutive addresses. The base is set by the chip-select decoding. Example: CS = 0 when A7 = 1 and A6–A2 = 0 (I/O-mapped):

A1 A0 Register Address
00 Port A 80H
01 Port B 81H
10 Port C 82H
11 Control register 83H

Control word (mode 0; port A out, port C upper out, port B in, port C lower in)

D7 D6 D5 D4 D3 D2 D1 D0
1 0 0 0 (A out) 0 (CU out) 0 (mode 0) 1 (B in) 1 (CL in)

CW=10000011=83H

It is written with MVI A, 83H then OUT 83H (the control register address in this example).

✓ Checked by computer We worked out the control word bit by bit in Python.

↑ Back to the question list

This question has the following parts.

(i) Explain the steps involved in interfacing a stepper motor to the 8255. Draw the interface schematic.

(ii) Indicate the steps involved in designing an 8-bit output port using partial decoding such that the port maps to any address between 80 H and FF H. Show also the hardware schematic.

2011 · Paper II · Q1c(i) · 10 marks · also asked 2011 (Q1c(ii))

Solution

(i) Stepper motor with the 8255

8085 +8255APort A(CW 80H)ULN2003Darlingtondrivers +clamp diodesWindingsA BC Dcommon → +VRotorPA3PA2PA1PA0Full-step sequence PA3–PA0: 1001 → 1100 → 0110 → 0011 → repeat
Darlington drivers with clamp diodes. On a phone, swipe sideways to see all of it.

Steps:

  1. Configure the 8255 with port A as output (control word 80H).
  2. Connect PA3–PA0 to the four windings through driver transistors or a Darlington array (ULN2003), with free-wheeling (clamp) diodes. The motor common goes to +V. The port cannot supply the winding current directly.
  3. Send the excitation sequence for the chosen drive:
    • full step (two phases on): 1001 → 1100 → 0110 → 0011 → repeat. The reverse order reverses the direction.
    • half step: 8 states.
  4. Wait a delay after each step. The delay sets the speed, and must be long enough for the rotor to settle (the maximum pull-in rate). For example, a 1.8° motor at 10 ms per step turns at 30 rpm.
  5. Count the steps for the required angle: angle = number of steps × step angle.
Instruction Comment
MVI A, 80H port A output
OUT CR
MVI A, 99H 1001 1001 (pattern repeated in both nibbles)
STEP: OUT PA energise
CALL DELAY wait
RRC 1100 1100 → 0110 0110 → 0011 0011 … next phase
JMP STEP (use RLC for the other direction)

(ii) 8-bit output port with partial decoding (80H–FFH)

Steps:

  1. List the required address range: 80H–FFH = 1xxx xxxx. Only A7 needs to be decoded: A7 = 1. A6–A0 are don’t-care.
  2. Generate the port select = A7 AND IOW. With active-low logic: invert A7 and NOR it with IOW.
  3. Use this signal as the enable (LE) of an 8-bit latch (74LS373) on the data bus, because an output port must hold the data after the OUT cycle.
  4. Connect the latch outputs to the device (LEDs or a display).
8085A7IOWD7–D0NOTNOR74LS373latchLELEDs /deviceLE = A7 · IOWA6–A0 not decoded → 128 foldback addresses (80H–FFH)
Only A7 is decoded. On a phone, swipe sideways to see all of it.

Any OUT with a port address from 80H to FFH writes this port: 128 foldback addresses. This is cheap, but those addresses cannot be used by other output ports.

✓ Answer checked step by step Standard result.

↑ Back to the question list

This question has the following parts.

(i) Draw the block diagram of a microprocessor-based process control system, making use of data acquisition systems, sensor inputs, outputs connected to relays, DACs. Explain the scheme briefly.

(ii) Design an interface to a microcomputer port using the LM334 temperature sensor and LM393 analog comparator. A logic 1 i/p should indicate a temperature of greater than 100 °F. (Corresponding voltage for this sensor is 3.11 volts.)

2011 · Paper II · Q6b(i) · 12 marks · also asked 2011 (Q6b(ii))

Solution

(i) Microprocessor-based process control system

Process /plantSensors(T, P, flow…)SignalconditioningAnalogMUXS/H + ADCMicroprocessor (CPU, memory,I/O ports, timer, display, keyboard)DACsActuators(valves, drives)RelaydriversOn/offloads, alarmsfeedback
Data acquisition in, DACs and relays out. On a phone, swipe sideways to see all of it.

Inputs. Sensors (temperature, pressure, flow, level) convert process variables into electrical signals. Signal conditioning amplifies and filters them and scales them to 0–5 V. An analog multiplexer selects one channel at a time, a sample-and-hold freezes it, and an ADC converts it. Together these form the data-acquisition system. Digital inputs (limit switches) go to an input port directly.

Processing. The microprocessor, with memory, I/O ports, a timer, a keyboard and a display, reads each channel in turn. It compares the readings with set points and computes the control action (on/off, or PID), logs data and raises alarms.

Outputs.

  • DACs convert the computed values to analog signals for continuous actuators (control valves, variable-speed drives).
  • Relay drivers (transistors with relays) on output port bits switch heaters, pumps, motors and alarms on or off.

The actuators change the process, and the sensors measure the result again, so the loop is closed.

(ii) Temperature switch with LM334 and LM393

LM334current sensor(R_set)Load resistor10 mV/KDivider5 V → 3.11 VLM393+ : sensor− : 3.11 VInput portbit D0(pull-up 4.7 kΩ)V_TV_refopen coll.V_T > 3.11 V (T > 100 °F) → output 1
Typical values; the divider can be a trim pot for calibration. On a phone, swipe sideways to see all of it.
  • The LM334 used as a temperature sensor gives a current proportional to absolute temperature. With its load resistor this is scaled to 10 mV/K: 100∘F=310.9K⇒VT=3.109≈3.11V.

  • The LM393 comparator has the sensor voltage on its non-inverting (+) input. The inverting (−) input gets Vref=3.11 V from a divider across +5 V: for example 1.89 kΩ (top) and 3.11 kΩ (bottom), or a 10 kΩ trim pot for calibration.

  • The LM393 has an open-collector output, so a 4.7 kΩ pull-up to +5 V makes it TTL compatible. It goes to one bit (D0) of an input port: a tri-state buffer such as the 74LS244 enabled by the port decoder, or a bit of an 8255 port.

  • Operation:

    • when T > 100 °F, VT > 3.11 V and the output transistor turns off: logic 1;
    • below 100 °F, the output is 0.

    A large feedback resistor from the output to the + input adds a little hysteresis, which prevents chatter near the threshold.

The program reads the port and tests D0 (IN port, ANI 01H, JNZ HOT).

✓ Checked by computer We computed the sensor voltage at 100 °F and the reference divider in Python.

↑ Back to the question list

This question has the following parts.

(i) What are the features of three sources of interrupts that 8086 has?

(ii) What are the three operations possible in the ‘string’ group? What are the registers used by the instructions in this group?

(iii) Write the block diagram indicating how 8255A PPI is interfaced to 8086 max mode CPU module, using two 8255As for 16-bit I/O operation.

2011 · Paper II · Q7b(i) · 6 marks · also asked 2011 (Q7b(ii)), 2011 (Q7b(iii))

Solution

(i) Three sources of interrupts in the 8086

  1. Hardware, external.
    • NMI: non-maskable, rising-edge triggered, type 2 (vector at 00008H).
    • INTR: maskable through the IF flag (STI, CLI), level triggered. It is acknowledged by two INTA pulses, and the device (usually an 8259A) supplies an 8-bit type number. The vector address is 4 × type.
  2. Software. The instruction INT n (n = 0–255) calls any of the 256 vectors; INT 3 is a 1-byte breakpoint and INTO is interrupt on overflow (type 4). These let programs call system services.
  3. Internal (processor-generated exceptions).
    • Type 0: divide error.
    • Type 1: single-step, when TF = 1.
    • Type 4: overflow (with INTO).
    These are produced by the CPU itself during execution.

All of them use the same interrupt vector table at 00000H–003FFH: 4 bytes (IP, CS) per type. On entry, the CPU pushes the flags, CS and IP, and clears IF and TF.

(ii) String group

  • Operations:

    • move (MOVS);
    • compare (CMPS), scan (SCAS);
    • load (LODS) and store (STOS), with the prefix REP, REPE, REPNE.

    These are usually summed up as three operations: move/copy, compare/scan (search), and load/store.

  • Registers used:

    • SI, the source offset, in the DS segment;
    • DI, the destination offset, in the ES segment;
    • CX, the count for the REP prefixes;
    • AL/AX, the data for SCAS, LODS and STOS.
  • Direction: the DF flag sets the direction. CLD makes SI and DI auto-increment; STD makes them auto-decrement (by 1 for bytes, 2 for words).

(iii) Two 8255As for 16-bit I/O on an 8086 maximum-mode CPU module

8086(max mode)S2–S0, BHE,AD15–AD08288 buscontrollerAddress latches74LS373 (ALE)Data transceivers8286 (DT/R, DEN)I/O addressdecoder8255A (even)D0–D7A0, A1 ← A1, A2CS: decoder & A0 = 08255A (odd)D0–D7 ← D8–D15A0, A1 ← A1, A2CS: decoder & BHE = 0Ports A, B, C(low byte)Ports A, B, C(high byte)S2–S0A15–A0D7–D0D15–D8IORC, AIOWC → RD, WR
A typical arrangement; address decoding details vary. On a phone, swipe sideways to see all of it.
  • In maximum mode, the 8288 bus controller decodes S2–S0 into the command signals IORC and AIOWC. These drive RD and WR of both 8255As.
  • Addresses are latched by 74LS373s using ALE, and data passes through 8286 transceivers (DT/R, DEN).
  • One 8255A sits on the low data byte D7–D0 and is selected when A0 = 0. The other sits on the high byte D15–D8 and is selected when BHE = 0.
  • Address lines A1 and A2 select the port or control register in each chip (A0 is used for the byte selection), and the higher address lines go to the decoder for CS.
  • A 16-bit IN AX, port or OUT port, AX at an even address enables both chips together, giving 16-bit ports: for example port A of both chips as one 16-bit port.

✓ Answer checked step by step Standard result.

↑ Back to the question list

What are the functions of DMA (Direct Memory Access)? How are HOLD and HLDA lines used in DMA operation? List the data transfer modes of DMA controller. Describe each mode in brief.

2010 · Paper II · Q7b · 20 marks

Solution

Functions of DMA

  • It transfers blocks of data directly between memory and a fast peripheral (disk, CRT, high-speed ADC, communication link) without the CPU executing instructions for each byte.
  • This gives the highest transfer rate (one bus cycle per byte), and frees the CPU from I/O work.
  • The DMA controller generates the memory addresses, counts the bytes, and produces the read/write control signals itself.

Use of HOLD and HLDA

  • When the device wants a transfer, it raises DRQ to the DMA controller, which raises HOLD to the 8085.
  • The 8085 finishes the current machine cycle and then floats its address, data and control buses. It raises HLDA (hold acknowledge) to tell the controller that the buses are free.
  • The controller then sends DACK to the device and performs the transfers.
  • When it has finished (terminal count, or the device is done), it lowers HOLD. The 8085 then lowers HLDA and takes back the buses on the next clock.
  • (The question writes HLDA; on the 8085 HLDA is active-high.)

Data transfer modes of a DMA controller (8257/8237)

  1. Single-transfer (cycle-stealing) mode. One byte per request. HOLD is dropped after each byte, so the CPU gets the bus between bytes.
  2. Block (burst) transfer mode. One request transfers the whole block. HOLD is kept until the count is complete, which is the fastest.
  3. Demand mode. Transfers continue as long as DRQ stays active. They pause when the device drops DRQ, and resume later from the same address and count.
  4. Cascade mode (8237). Several DMA controllers are connected for more channels.

Types of transfer: memory → I/O (DMA read), I/O → memory (DMA write), memory → memory (8237, using two channels), and verify (addresses generated, no data moved).

✓ Answer checked step by step Standard result.

↑ Back to the question list

Which I/O technique provides the highest data transfer rate? Explain the function of DMA. Draw the block diagram of a DMA controller with memory interfacing. What is meant by simultaneous DMA? List three different DMA modes for transferring data. How is the DMA controller is programmed? Are special buffers required when interfaces a DMA controller?

2007 · Paper II · Q7a · 20 marks

Solution

Highest data-transfer rate. DMA gives the highest rate. Each byte moves in one bus cycle, directly between the device and memory, with no instruction fetch or execution by the CPU. Programmed I/O and interrupt-driven I/O are slower, because each byte needs several instructions (and, for interrupts, the overhead of saving and restoring).

Function of DMA. It lets a peripheral read or write memory directly while the CPU is held off the bus (HOLD/HLDA). The DMA controller supplies:

  • the memory address (incremented automatically);
  • the byte count (decremented to terminal count);
  • the control signals MEMR, MEMW, IOR and IOW.

Block diagram with memory interfacing

8085HOLD ←HLDA →DMA controlleraddress & countregistersMEMR, MEMW,IOR, IOWMemoryI/O device(disk, ADC…)System address / data / control busesHOLDHLDADRQDACK
DRQ/DACK with the device; HOLD/HLDA with the CPU. On a phone, swipe sideways to see all of it.

During DMA:

  • the controller places the address on A15–A0 (in the 8257, the upper byte goes through an external latch via ADSTB and AEN);
  • AEN (address enable) disables the CPU address latch and the I/O decoder;
  • data passes on the data bus directly between memory and the device that received DACK.

Simultaneous DMA. Data is transferred while the CPU is also working: the DMA uses bus cycles that the CPU does not need (as in transparent or interleaved DMA), or a separate bus or dual-port memory. The CPU is therefore not halted. The term is also used for several channels being requested at the same time and served in priority order (rotating or fixed).

Three DMA modes: single-transfer (cycle-stealing); block (burst); demand. (Others: cascade, and transparent.)

How the DMA controller is programmed. The CPU writes, as an I/O device:

  1. the starting address of the memory block into the channel address register (low byte, then high byte);
  2. the terminal count, the number of bytes − 1, together with the transfer type (read/write/verify) into the count register;
  3. the mode-set register: enable the channel, choose priority (fixed or rotating), auto-load, TC stop, and extended or normal write.

The controller then waits for DRQ.

Are special buffers needed? Yes, in most systems.

  • The DMA controller drives the system buses, so the CPU’s address, data and control buffers must be tri-state and disabled during DMA, using HLDA and AEN.
  • The controller’s own outputs need buffers or latches. For example, the 8257 multiplexes the upper address on its data lines, so it needs an external 8-bit latch strobed by ADSTB.
  • Bidirectional data buffers (74LS245) are needed where bus loading or direction control requires them.

✓ Answer checked step by step Standard result.

↑ Back to the question list

What minimum functions are required in a programmable device? Point out the difference between control logic and control word with examples. Write the steps to compute the control word, say of 8255.

2005 · Paper II · Q4a · 20 marks

Solution

Minimum functions of a programmable device (8255, 8253, 8279, 8251 …)

  1. Bus interface. A data bus buffer (tri-state) and read/write logic with chip select and register-select lines, so the CPU can address it like an I/O port or a memory location.
  2. Command (control) register(s). Hold the control word that selects the mode of operation.
  3. Data registers or ports. For the data being handled.
  4. Status information. Readable by the CPU (ready, buffer full, end of count …) for polling.
  5. Internal control logic. Carries out the selected mode: handshake, timing, interrupt request.

Control logic and control word

Control logic Control word
The hardware inside the device (decoders, flip-flops, gates) that interprets commands and generates the internal and external control signals The byte (software) written by the CPU into the control register to tell the control logic what to do
Fixed by design; the same in every application Chosen by the programmer for each application; can be changed at run time
Example: the read/write control logic of the 8255 uses CS, A1 A0, RD, WR to route data to port A, B, C or the control register Example: writing 82H to the 8255 control register makes ports A and C outputs and port B an input, all in mode 0

Steps to compute the control word of the 8255

  1. Decide each port’s function and direction from the application: port A, port C upper, port B, port C lower; input or output.

  2. Decide the modes: group A mode 0, 1 or 2; group B mode 0 or 1. Remember that mode 1 or 2 takes over certain port C lines.

  3. Set D7 = 1 (I/O mode set).

  4. Fill D6 D5 = group A mode, D4 = port A (1 in / 0 out), D3 = port C upper, D2 = group B mode, D1 = port B, D0 = port C lower.

  5. Write the 8 bits and convert to hex.

    Example: A out, B in, C all out, mode 0 → 1000 0010 = 82H.

  6. Write it to the control register address (A1 A0 = 11): MVI A, 82H then OUT CR.

For port C bit control, use the BSR word instead: D7 = 0, D3–D1 = bit number, D0 = set/reset.

✓ Answer checked step by step Standard result.

↑ Back to the question list

Select any three of the following statements, read them carefully and identify the correct and the incorrect ones. Justify your answer using not more than 200 words in each case. The memory mapping for the circuit shown below is 2000H to 2OFPH, assuming A8, A9, and A10 to be zero.

3-to-8decoderO0 … O7A15 → E2A14 → E1+5 V → E3A13A12A11Peripheral chipCEIO/M, ALERD, WR, RESETAD7–AD0O4
Figure redrawn from the question paper. On a phone, swipe sideways to see all of it.

2005 · Paper II · Q200w/5a · 20 marks

Solution

Correct.

Decoder enabling

  • E1 = A14 and E2 = A15 are active low, so the decoder is enabled only when A15 = 0 and A14 = 0.
  • E3 is tied to +5 V, so it is always enabled.

Selected output. O4 is active when A13 A12 A11 = 100.

So the chip is selected for A15A14A13A12A11=00100.

A15–A12 A11–A8 A7–A0
0010 0000 0000 0000 2000H
0010 0000 1111 1111 20FFH

With A10, A9 and A8 = 0 as stated, the chip occupies 2000H to 20FFH: 256 locations, covered by AD7–AD0. The printed “2OFPH” means 20FFH. So the statement is correct.

Note. A10–A8 are not decoded. Without the stated assumption, the same 256 locations would also appear at 2100H, 2200H … 27FFH (partial decoding, 8 foldback blocks). The chip receives IO/M and ALE: it is typically an 8155, whose RAM is selected with IO/M = 0. With IO/M = 1, the same select gives its I/O ports.

✓ Checked by computer We decoded the address lines for O4 in Python.

↑ Back to the question list

Select any THREE of the following statements, read them carefully and identify the correct and the incorrect ones. Justify your answer using not more than 200 words in each case:- Latch is used at input and tristate is used for output purposes in the microprocessor based system.

2004 · Paper II · Q200w/5a · 20 marks

Solution

Incorrect. It is the other way round: a latch is used for output and a tri-state buffer for input.

  • Output port: latch. The CPU puts data on the data bus only for a fraction of a microsecond, during WR of the OUT (or STA) cycle. A device such as an LED display, a DAC or a relay needs the data to stay until the next write. So the output port uses a latch (74LS373 or 74LS374), enabled by the decoded port address and IOW, which holds the data.
  • Input port: tri-state buffer. An input device (switches, ADC) drives its data all the time. If it were connected straight to the data bus, it would clash with the memory and other devices. So it goes through a tri-state buffer (74LS244), enabled only during IOR for that port. The rest of the time its outputs are in the high-impedance state and the device is isolated from the bus.

(Where the input data is fleeting, as from a strobed keyboard, a latch may be added in front of the tri-state buffer: a “latched input”. The bus connection is still tri-state.)

✓ Answer checked step by step Standard result.

↑ Back to the question list

More on Microprocessors and Microcomputers

Questions: UPSC Civil Services (Main) Examination, Electrical Engineering Paper II, 2004–2026. Solutions: Optional Province. Found an error? Tell us.

Spotted an error? Tell us.

We classify every PYQ with care, but mistakes can slip in. If a question is in the wrong topic, has a typo, the wrong year, or is missing, let us know. We review every report and update the page.

Report an Error
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted