ADC0808/ADC0809 is an 8 channel 8-bit analog to digital converter. Unlike ADC0804 which has one Analog channel, this ADC has 8 multiplexed analog input channels. This tutorial will provide you basic information regarding this ADC, testing in free run mode and interfacing example with 8051 with sample program in C and assembly.

ADC0808/ADC0809 Introduction


  • IN0-IN7: Analog Input channels
  • D0-D7: Data Lines
  • A, B, C: Analog Channel select lines; A is LSB and C is MSB
  • OE: Output enable signal
  • ALE: Address Latch Enable
  • EOC: End of Conversion signal
  • Vref+/Vref-: Differential Reference voltage input
  • Clock: External ADC clock input

Device Operation and Free Run Testing

This part of the tutorial was written by Chinmay Das.

center

ADC0808 Free running Circuit

Normally analogue-to-digital converter (ADC) needs interfacing through a microprocessor to convert analogue data into digital format. This requires hardware and necessary software, resulting in increased complexity and hence the total cost. The circuit of A-to-D converter shown here is configured around ADC 0808, avoiding the use of a microprocessor. The ADC 0808 is an 8-bit A-to-D converter, having data lines D0-D7. It works on the principle of successive approximation. It has a total of eight analogue input channels, out of which any one can be selected using address lines A, B and C. Here, in this case, input channel IN0 is selected by grounding A, B and C address lines.

Usually the control signals EOC (end of conversion), SC (start conversion), ALE (address latch enable) and OE (output enable) are interfaced by means of a microprocessor. However, the circuit shown here is built to operate in its continuous mode without using any microprocessor. Therefore the input control signals ALE and OE, being active-high, are tied to Vcc (+5 volts). The input control signal SC, being active-low, initiates start of conversion at falling edge of the pulse, whereas the output signal EOC becomes high after completion of digitization. This EOC output is coupled to SC input, where falling edge of EOC output acts as SC input to direct the ADC to start the conversion.

As the conversion starts, EOC signal goes high. At next clock pulse EOC output again goes low, and hence SC is enabled to start the next conversion. Thus, it provides continuous 8-bit digital output corresponding to instantaneous value of analogue input. The maximum level of analogue input voltage should be appropriately scaled down below positive reference (+5V) level.

The ADC 0808 IC requires clock signal of typically 550 kHz, which can be easily derived from an Astable multi-vibrator constructed using 7404 inverter gates. In order to visualize the digital output, the row of eight LEDs (LED1 through LED8) have been used, where in each LED is connected to respective data lines D0 through D7. Since ADC works in the continuous mode, it displays digital output as soon as analogue input is applied. The decimal equivalent digital output value D for a given analogue input voltage Vin can be calculated from the relationship.

center

ADC0808 Clock input

Interfacing ADC0808/ADC0809 with 8051

Circuit Diagram


Note: Reset and oscillator circuit is not shown in above circuit, But its needed for 8051

Sample C Code

#include <reg51.h>

#define ALE		P3_4
#define OE		P3_7
#define START		P3_5
#define EOC		P3_6
#define SEL_A		P3_1
#define SEL_B		P3_2
#define SEL_C		P3_3
#define ADC_DATA	P1

void main()
{
	unsigned char adc_data;

	/* Data port to input */
	ADC_DATA = 0xFF;

	EOC = 1; /* EOC as input */
	ALE = OE = START = 0;

	while (1) {
		/* Select channel 1 */
		SEL_A = 1; /* LSB */
		SEL_B = 0;
		SEL_C = 0; /* MSB */

		/* Latch channel select/address */
		ALE = 1;

		/* Start conversion */
		START = 1;

		ALE = 0;
		START = 0;
	
		/* Wait for end of conversion */
		while (EOC == 1);
		while (EOC == 0);

		/* Assert Read signal */
		OE = 1;
	
		/* Read Data */
		adc_data = ADC_DATA;
	
		OE = 0;

		/* Now adc data is stored */
		/* start over for next conversion */
	}
}

Sample 8051 Assembly source

	ale equ	P3.4
	oe equ P3.7
	start equ P3.5
	eoc equ P3.6
	sel_a equ P3.1
	sel_b equ P3.2
	sel_c equ P3.3
	adc_data equ P1

	org 0H

	;Data port to input
	mov adc_data, #0FFH

	;EOC as Input
	setb eoc
	;rest of output signals
	clr ale
	clr oe
	clr start

main_loop:
	;Select Analog Channel 1
	setb sel_a
	clr sel_b
	clr sel_c

	;Latch channel select
	setb ale

	;Start conversion
	setb start

	clr ale
	clr start

	;Wait for end of conversion
	jb eoc, $ ; $ means jump to same location
	jnb eoc, $

	;Assert read signal
	setb oe

	; Read Data
	mov A, adc_data

	clr oe

	;ADC data is now in accumulator
	;Start over for next conversion

	sjmp main_loop

	end

You'll find it identical to C (because it is identical) so if you are thinking to start working in C language then its a good time :) it will help in future.

Further Reading

Help & Queries

If you have any queries, doubts or feedback on this tutorial please share in our discussion forum. If you want us to write tutorial for more devices please let us know in the forum.

Powered by MediaWiki
This page was last modified on 3 March 2015, at 14:56.
ArrayContent is available under Creative Commons Attribution Non-Commercial Share Alike unless otherwise noted.