How to interface ADC0804 using 8051 microcontroller (AT89C51)- (Part 22/45)

Group all Htabs

Description

Developed By:

Himanshu Choudhary

ADC0804is one of the most commonly used analog to digital converter IC. In many applications it is required to convert the output of the sensor, which is analogue in nature to a digital form. The data in digital format can then be utilized for further processing by the digital processors. Typical applications include sound processing, temperature processing etc. This circuit demonstrates the principle and operation of interfacing a simple ADC 0804 using 8051 microcontroller (AT89C51).

ADC0804 is connected as shown in the circuit diagram. Here the input is taken from a preset, which gives different analog signals to the ADC. The output pins of the ADC are connected to LEDs. The control pins of the ADC are connected to the microcontroller AT89C51.

ADC0804 is a single channel analog to digital convertor i.e., it can take only one analog signal. An ADC has n bit resolution (binary form) where n can be 8,10,12,16 or even 24 bits. ADC 0804 has 8 bit resolution. The higher resolution ADC gives smaller step size. Step size is smallest change that can be measured by an ADC. For an ADC with resolution of 8 bits, the step size is 19.53mV (5V/255).

The time taken by the ADC to convert analog data into digital form is dependent on the frequency of clock source. ADC0804 can be given clock from external source. It also has an internal clock. However the conversion time cannot be more than110us. To use the internal clock a capacitor and resistor is connected to pin 19 and 4 as shown in the circuit diagram. The frequency is given by the relation f= 1/ (1.1RC). The circuit uses a resistance of 10k and a capacitor of 150pF to generate clock for ADC0804. Vin, which is the input pin, is connected to a preset to provide analog input.

Pin Description

1.CS, Chip Select: This is an active low pin and used to activate the ADC0804.

2.RD, Read: This is an input pin and active low. After converting the analog data, the ADC stores the result in an internal register. This pin is used to get the data out of the ADC 0804 chip. When CS=0 & high to low pulse is given to this pin, the digital output is shown on the pins D0-D7.

3.WR, Write: This is an input pin and active low. This is used to instruct the ADC to start the conversion process. If CS=0 and WR makes a low to high transition, the ADC starts the conversion process.

4.CLK IN, Clock IN: This is an input pin connected to an external clock source.

5.INTR, Interrupt: This is an active low output pin. This pin goes low when the conversion is over.

6.Vin+ : Analog Input .

7.Vin- : Analog Input. Connected to ground.

8.AGND: Analog Ground.

9.Vref/2: This pin is used to set the reference voltage. If this is not connected the default reference voltage is 5V. In some application it is required to reduce the step size. This can be done by using this pin.

10. DGND: Digital Ground.

11-18. Output Data Bits (D7-D0).

19. CLKR: Clock Reset.

20. Vcc: Positive Supply

In this circuit microcontroller is used to provide the control signals to the ADC. CS pin of ADC is directly connected to ground. The pin P1.1, P1.0 and P1.2 are connected to the pin WR, RD and INTR of the ADC respectively. When the input voltage from the preset is varied the output of ADC varies which can be seen on the LCD. When the preset is at minimum level, no LED glows and when the preset is at maximum position all the LEDs starts glowing.

The following steps are used to interface the ADC0804.

1.Send a low to high pulse to pin WR to start the conversion.

2.Keep monitoring the INTR pin. If INTR is low, go to next step else keep checking the status.

3. A high to low pulse is sent to the RD pin to bring the converted data on the output pins.

Analog to digital converters find huge application as an intermediate device to convert the signals from analog to digital form. These digital signals are used for further processing by the digital processors. Various sensors like temperature, pressure, force etc....