Skip to main content

ADC804 with 8255 control word and program

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.

[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.

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.

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.

✓ Answer checked by Claude Sonnet 5.5

All Instrumentation II chapter 4 questions →