Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

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

By EG Projects July 16, 2019

In this tutorial will learn how to interface ADC0804(Analog to Digital Converter) with 8051(89c51,89c52) microcontroller. 8051 microcontrollers are pretty old and don’t have a build in analog to digital converter in them unlike their new rivals(Arduino, Pic microcontroller and many more). Hence we can not directly measure any analog value (voltage, Temperature present in the atmosphere) with 8051 microcontrollers. So to measure an analog quantity with 8051 microcontroller we need an external device which can measure analog quantity and pass it to 8051 microcontroller. Since 8051 series microcontrollers works on digital data, the external device must convert the analog data to digital before passing it to 8051 microcontroller. Analog to digital converters are used for this purpose. 

ADC0804 Analog to digital Converter

ADC0804 is a popular analog to digital converter among the diy circuit makers. It measures analog quantity & outputs digital reading of the measured analog quantity. Operating and interfacing adc0804 with microcontrollers is a difficult task. Adc0804 operations (start converting the analog voltage to digital, stop conversion, output data) must be controlled by an external controller. In our case 89c51 microcontroller is going to control all the adc0804 operations. Adc0804 has dedicated pins to control its operations by an external unit. Adc0804 has 8 bit resolution, means it can output max value of 255 minimum is 0. To learn more about adc0804, its working principle, pin out and interfacing with microcontrollers below is a good tutorial for you. 

Adc0804 Pin Out and Working

Diy Project

I am going to measure temperature of room using 8051 microcontroller. I am going to use LM35 temperature sensor to measure room temperature. Lm35 temperature sensor outputs an analog signal(voltage) by measuring the temperature present in the atmosphere. ADC0804 is used to convert the analog reading from lm35 in to digital. After converting the reading to digital the value will be passed to 8051 microcontroller.
NOTE: The above tutorial on ADC0804 is very important in order to understand the code below.

Project requirements

  • 16×2 lcd             – For displaying 8-bit value from ADC0804.
  • 89c51 or 89c52 Microcontroller .
  • ADC0804           – For analog to digital conversions.
  • Potentiometer    – To adjust contrast of the lcd.
  • Bread board       – To design circuit.
  • Crystal                – I used 11.0592 Hz you can use of your choice, but its better to use same as i used.
  • Voltage supplier  – 5 volts.
  • Connecting wires – For making connections.

Project Circuit

The circuit of the project is not mush complex if you have taken the above tutorials. First insert 16×2 lcd, 89c51 and ADC0804 in your bread board. Make simple connections. Apply 5 volts to pin 40 and 31 of 89c51 microcontroller. Ground Pin 20. Connect Crystal(11.0592) to pin 18 and 19 of microcontroller in parallel to two 33pF capacitors. Connect reset button to pin 9 of 89c51 microccontroller. 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 vref/2 pin of ADC0804. This is the reference voltage for ADC0804. This is the voltage by which the step size of the ADC0804 will be set to 10 mv. LM35 output voltage varies 10 mV per °C change in temperature. Hence both the LM35 and ADC0804 are now working at 10 mv change. when there is 10 mv change in temperature the output Increments/decrements by 1. 
To learn more about Lm35 temperature sensor working, pin out and formula to calculate temperature go through the below tutorial. 

Lm35 Pin Out and temperature conversion formula

At last connect Port-1 of 89c51 microcontroller with 8-bit output of ADC0804, and connect Port-2 with 8-bit input of 16×2 lcd. Circuit diagram of the project is given below.
adc0804 with 8051 microcontroller

adc0804 with 8051 microcontroller

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

Comming to the code first i included the header file reg51.h, you must include this header file in your every project in which you are using 8051(89c51,89c52) microcontroller. Then port three pins 5 and 6 are defined as rs(regester select) and en(enable) to be used for controlling lcd. If you dont know how to use 16×2 lcd then first take a small tutorial on 

  • WORKING OF 16×2 LCD

Port-3 pins 0, 1, 2 and 3 are used as cs(chip select) wr(write) rd(read) intr(interrupt) to control ADC0804. Project code is given below and each statement well explained.

More advance project on adc0804 is measure room temperature using 89c52 microcontroller, 16×2 lcd and adc0804. Tutorial contains free source code and circuit diagram of the project. Below button will take you to the project. 

Measuring room temperature with 89c51 microcontroller

See The project video…..

Download the project files and code(c,HEX) compiled in keil uvision 4. If you feel any problem in any statement or part of code just leave a comment below. Please give us your feed back on the Project.

ADC0804 with 8051(89c51,89c52) Microcontroller


Filed Under: 8051 Microcontroller, Electronic Projects, Microcontroller Projects

 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: Internet of Things
Explore practical strategies for minimizing attack surfaces, managing memory efficiently, and securing firmware. Download now to ensure your IoT implementations remain secure, efficient, and future-ready.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • How to simulate power electronics converter in PSpice?
  • High Side current sensing
  • Voltage mode pushpull is a nonsense SMPS?
  • Layout IRN reduction in Comparator
  • What Are the Main Types of Current Sensors?

RSS Electro-Tech-Online.com Discussions

  • Back to the old BASIC days
  • Parts required for a personal project
  • PIC KIT 3 not able to program dsPIC
  • Failure of polypropylene motor-run capacitors
  • Siemens large industrial PLC parts

Featured – RPi Python Programming (27 Part)

  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained
  • RPi Python Programming 25 – Synchronous serial communication in Raspberry Pi using I2C protocol
  • RPi Python Programming 26 – Interfacing ADXL345 accelerometer sensor with Raspberry Pi

Recent Articles

  • What is AWS IoT Core and when should you use it?
  • AC-DC power supply extends voltage range to 800 V DC
  • Infineon’s inductive sensor integrates coil system driver, signal conditioning circuits and DSP
  • Arm Cortex-M23 MCU delivers 87.5 µA/MHz active mode
  • STMicroelectronics releases automotive amplifiers with in-play open-load detection

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe