ADC0804 is 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).
Project Source Code
###
//Program to check the working of ADC0804 using LED's on its output port. #include<reg51.h> #define input P0 //Input port to read the values of ADc #define output P2 // Output port, connected to LED's. sbit wr= P1^1; // Write pin. It is used to start the conversion. sbit rd= P1^0; // Read pin. It is used to extract the data from internal register to the output pins of ADC. sbit intr= P1^2; // Interrupt pin. This is used to indicate the end of conversion. It goes low when conversion is complete. void delay(unsigned int msec ) // The delay function provides delay in msec. { int i,j ; for(i=0;i<msec;i++) for(j=0; j<1275; j++); } void adc() // Function to read the values from ADC and display on the LED's. { rd=1; wr=0; delay(1); wr=1; while(intr==1); rd=0; output=input; delay(1); intr=1; } void main() { input=0xff; // Declare port 0 as input port. while(1) { adc(); } }###
Circuit Diagrams
Project Components
Project Video
Filed Under: 8051 Microcontroller
Filed Under: 8051 Microcontroller
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.