Interface Analógico para Digital Converter-adc0804 com Microcontrolador 8051(89c51,89c52)

Analog to Digital Interface Converter-adc0804 with 8051 Microcontroller(89c51,89c52)

In this tutorial we will learn how to interface the ADC0804 (Analog to Digital Converter) with the 8051 microcontroller (89c51,89c52). 8051 microcontrollers are very old and do not have a built-in analog to digital converter, unlike their newer rivals (Arduino, Pic microcontroller and many more). So we cannot directly measure any analog value (voltage, temperature present in atmosphere) with 8051 microcontrollers. So to measure an analog quantity with 8051 microcontroller we need an external device which can measure the analog quantity and pass it to the 8051 microcontroller. Since 8051 series microcontrollers work with digital data, the external device must convert the analog data to digital before passing it to the 8051 microcontroller. Analog-to-digital converters are used for this purpose.

ADC0804 Analog to Digital Converter

ADC0804 is an analog to digital converter popular among DIY circuit makers. It measures the analog quantity and generates digital reading of the measured analog quantity. Operating and interfacing the adc0804 with microcontrollers is a difficult task. The Adc0804 operations (start of analog voltage conversion into digital, conversion stop, data output) must be controlled by an external controller. In our case, the 89c51 microcontroller will control all operations of the adc0804. The Adc0804 has dedicated pins to control its operations from an external unit. Adc0804 has 8-bit resolution, means it can output a maximum value of 255, the minimum is 0 . To know more about adc0804, its working principle, pinout and interface with microcontrollers below is a good tutorial for you.

Adc0804 Pinout and operation

DIY project

I will measure the room temperature using 8051 microcontroller. I will use LM35 temperature sensor to measure the room temperature. The Lm35 temperature sensor emits an analog signal (voltage) measuring the temperature present in the atmosphere. ADC0804 is used to convert lm35 analog reading to digital. After converting the reading to digital, the value will be passed to the 8051 microcontroller.
NOTE: The above tutorial on ADC0804 is very important for understanding the code below.

Project requirements

  • 16×2 LCD – To display the 8-bit value of the ADC0804.
  • 89c51 or 89c52 microcontroller.
  • ADC0804 – For analog to digital conversions.
  • Potentiometer – To adjust the LCD contrast.
  • Breadboard – To design the circuit.
  • Crystal – I used 11.0592 Hz you can use whatever you want, but it's better to use the same as what I used.
  • Voltage supplier – 5 volts.
  • Connecting wires – For making connections.

Design Circuit

The project circuit is not very complex if you followed the tutorials above. First insert LCD 16×2, 89c51 and ADC0804 into your breadboard. Make simple connections. Apply 5 volts to pins 40 and 31 of the 89c51 microcontroller. Ground pin 20. Connect the Crystal (11.0592) to pins 18 and 19 of the microcontroller in parallel to two 33pF capacitors. Connect the reset button to pin 9 of the 89c51 microcontroller. Connect port 3 pin 0 to cs (chip select) of ADC0804, port 3 pin 1 to wr pin of ADC0804, port 3 pin 2 to rd pin of ADC0804, port 3 pin 3 to intr pin of ADC0804. Port-3 pin-5 of 8051 to RS pin of 16×2 LCD, Port-3 pin-6 of 8051 to EN pin of 16×2 LCD, Make RW pin of 16×2 LCD ground.

Apply 1.28 volts to the vref/2 pin of the ADC0804. This is the reference voltage for ADC0804. This is the voltage at which the step size of the ADC0804 will be set to 10 mv. The LM35 output voltage varies by 10 mV per °C change in temperature. Consequently, both the LM35 and ADC0804 are now working with 10 mv shift. when there is a 10 mv change in temperature, the output increases/decreases by 1.
To learn more about the operation of the Lm35 temperature sensor, pinout and formula for calculating the temperature, follow the tutorial below.

Lm35 Pin Out and Temperature Conversion Formula

Finally, connect Port-1 of 89c51 microcontroller with 8-bit output of ADC0804 and connect Port-2 with 8-bit input of 16×2 LCD. The circuit diagram of the project is given below.
adc0804 with 8051 microcontroller

adc0804 with 8051 microcontroller

ADC0804 with 8051 microcontroller(89c51,89c52) CODE

Coming to the code first, I have included the reg51.h header file, you must include this header file in all your projects where you are using 8051 (89c51,89c52) microcontroller. Then the three-pin ports 5 and 6 are set to RS (Register Select) and EN (Enable) to be used to control the LCD. If you don't know how to use 16×2 LCD, first do a short tutorial on

  • 16×2 LCD OPERATION

Pins 0, 1, 2 and 3 of port 3 are used as cs(chip select) wr(write) rd(read) intr(interrupt) to control the ADC0804. The project code is given below and each instruction is well explained.

A more advanced project on the ADC0804 is to measure the ambient temperature using the 89C52 microcontroller, 16×2 LCD and ADC0804. The tutorial contains free source code and circuit diagram of the project. The button below will take you to the project.

Measuring room temperature with 89c51 microcontroller

See the project video…..

Download the project files and the code (c,HEX) compiled in keil uvision 4. If you have a problem with any instruction or part of the code, just leave a comment below. Please give us your feedback on the Project.
ADC0804 with 8051 microcontroller(89c51,89c52)

Conteúdo Relacionado

A network of sensors is embedded in every vehicle,...
The motor controller is one of the most important...
ESP32-CAM is a compact camera module that combines the...
A evolução dos padrões USB foi fundamental para moldar...
A SCHURTER anuncia um aprimoramento para sua conhecida série...
A Sealevel Systems anuncia o lançamento da Interface Serial...
A STMicroelectronics introduziu Diodos retificadores Schottky de trincheira de...
Determinar uma localização precisa é necessário em várias indústrias...
O novo VIPerGaN50 da STMicroelectronics simplifica a construção de...
A Samsung Electronics, fornecedora de tecnologia de memória avançada,...
O mercado embarcado tem uma necessidade de soluções de...
You have probably come across the term ' drag...
You probably have a support insulator if you've noticed...
You've probably seen stand an insulator sit on power...
You've probably seen shackle insulators enthroned on electricity poles,...
You have probably experienced situations where controlling a circuit...
Back to blog

Leave a comment

Please note, comments need to be approved before they are published.