---
title: "ADC804 with 8255 control word and program"
subject: "Instrumentation II"
chapter: 4
key: "semester_5/instrumentation_ii:adc804-8255-program"
source: https://www.bctengineer.com/q/semester_5/instrumentation_ii/adc804-8255-program
site: BCT Engineering
---

# ADC804 with 8255 control word and program

Instrumentation II · Chapter 4: Interfacing A/D And D/A Converters

- Asked in: 2074 Chaitra, 4+6 marks
- Answer checked by Claude Sonnet 5.5 on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_5/instrumentation_ii/adc804-8255-program
- Whole chapter: https://www.bctengineer.com/md/semester_5/instrumentation_ii/chapter-4

## Question

[Figure: ADC804 interfaced to an 8255 and an 8085-type bus. 8255: D0-D7 to the data bus; WR and RD from the bus; A0 and A1 to address lines A0 and A1; CS (active low) driven by A7; RESET grounded. 8255 PA0-PA7 connected to ADC804 data outputs D0-D7; ADC804 INTR connected to 8255 PC0. ADC804: RD and WR connected to the control lines; Vcc = 5 V; CLK R pin with 10k resistor and 150 pF capacitor to ground; CLK IN; Vin(+) from the wiper of a 10k POT across 5 V and ground, Vin(-), A GND, Vref/2 left at a pin and GND grounded; CS grounded.] What will be the control word for interfacing as shown in the figure above? Also write the subroutine program to read the digital data from ADC.

## Short answer

Control word: 93H (Port A input, Port C upper output, PC0 input). Program: pulse PC7 low-high to start; wait for PC0 low; pulse PC6 low to read Port A data into Accumulator. Resolution 5 V/256 = 19.5 mV.

## Answer

#### Interpretation of the figure
- 8255 chip select is driven by A7 (CS' = A7), so the 8255 responds when A7 = 0. Taking the other unused lines as 0, **Port A = 00H, Port B = 01H, Port C = 02H, Control = 03H**.
- PA0-PA7 receive the ADC804 data outputs, so **port A = input**.
- ADC804 INTR' goes to PC0, so **PC0 = input** (low = conversion complete).
- ADC804 WR' and RD' must be driven by the 8255 for the processor to start and read: assume WR' = PC7 and RD' = PC6, so **upper port C = output**.
- Port B is not used (set as input).

#### Control word
D7 = 1 (mode set); D6D5 = 00 (A mode 0); D4 = 1 (A input); D3 = 0 (C upper output); D2 = 0 (B mode 0); D1 = 1 (B input); D0 = 1 (C lower input):
1001 0011 = **93H**.

#### Subroutine to read the ADC
ADC804: conversion starts on the low to high edge of WR' (CS' = 0). INTR' goes low when conversion is complete. Data is read when RD' is low.
```text
READADC: MVI A,93H
         OUT 03H         ; initialise 8255
         MVI A,C0H       ; WR' = 1, RD' = 1 (idle)
         OUT 02H
         MVI A,40H       ; WR' = 0
         OUT 02H
         MVI A,C0H       ; WR' = 1 : rising edge starts conversion
         OUT 02H
WAIT:    IN 02H          ; read port C
         ANI 01H         ; test PC0 = INTR'
         JNZ WAIT        ; still converting (INTR' = 1)
         MVI A,80H       ; RD' = 0 (PC6 low) enables ADC data on bus
         OUT 02H
         IN 00H          ; read digital data from port A
         MOV B,A         ; save it
         MVI A,C0H       ; RD' = 1
         OUT 02H
         MOV A,B         ; result in accumulator
         RET
```
The digital value N = Vin / (Vref/256); with Vin from the pot between 0 and 5 V and the typical connection (Vref/2 pin open, Vref = 5 V), the resolution is 5 / 256 = 19.5 mV per count.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. With port A input, PC0 (lower C) input, upper C output, port B input, mode 0, what is the control word?
   A. 90H
   B. 93H
   C. 83H
   D. B3H
   Answer: B. D7=1, mode 0, D4=1 (A in), D3=0 (C upper out), D1=1 (B in), D0=1 (C lower in) gives 1001 0011 = 93H. (Key point: Control word)

2. How is a conversion started on the ADC804 in the subroutine?
   A. By holding RD' low
   B. By a high to low edge on INTR'
   C. By a low to high edge on WR' with CS' = 0
   D. By reading port A
   Answer: C. The program pulses WR' low and then high; the rising edge starts the conversion. (Key point: Starting conversion)

3. Why does the loop JNZ WAIT continue after ANI 01H on port C?
   A. PC0 (INTR') is still 1, so the conversion is not complete
   B. The conversion is finished
   C. RD' is low
   D. Port A is empty
   Answer: A. INTR' goes low when conversion completes; while it is high (non-zero result) the program keeps waiting. (Key point: Wait loop)

## Related in Instrumentation II

- [8255 mode 1 keyboard and printer with decoding](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Appi-keyboard-printer-mode1-fig) — Instrumentation II, chapter 2
- [8255 port addresses from decoder figure](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Appi-port-addresses-decoder-fig) — Instrumentation II, chapter 2
- [PCI bus; 8255 printer interface at 5500H](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Apci-printer-5500h) — Instrumentation II, chapter 2
- [ADC with 8085 using 8255: fan and heater control](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Aadc-8255-fan-heater) — Instrumentation II, chapter 4
- [8-channel ADC interface with 8255 and 8085](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Aadc8-8255-problem) — Instrumentation II, chapter 4
- [Double handshake data transfer with 8255-PPI](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Adouble-handshake-8255) — Instrumentation II, chapter 2

## Related in other subjects

- [Data bus and address bus width](https://www.bctengineer.com/question.md?key=semester_5%2Fcomputer_organization_and_architecture%3Abus-widths) — Computer Organization and Architecture, chapter 1, asked 2×
