Engineers Garage

  • Projects and Tutorials
    • Circuit Design
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Components
  • Articles
    • EG Blogs
    • Insight
    • Invention Stories
    • How to
    • What Is
    • News
      • EE Design News
      • DIY Reviews
      • Guest Post
      • Sponsored Content
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key 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
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • Video
    • White Papers
    • Webinars
  • EE Learning Center
  • Women in Engineering

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

July 16, 2019 By EG Projects

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

Related Articles Read More >

A Bluetooth-controlled datalogger robot
touch bell push
How to design a touchless bell push using Arduino
SMS-enabled scrolling message board using Arduino
Interfacing stepper motor with 8051(89c51,89c52 ) microcontroller

Featured Tutorials

  • Screenshot of Raspbian OS on Raspberry Pi RPi Python Programming 03: Raspberry Pi as Linux System
  • Raspberry Pi Models RPI Python Programming 02: Raspberry Pi Models
  • Raspberry Pi 4 RPi Python Programming 01: Introduction to Raspberry Pi 4
  • RPi Python Programming 05: Introduction to Python
  • RPi Python programming 04 RPi Python programming 04: Setting up Raspberry Pi Linux computer
  • Python Basics RPi Python Programming 06: Python basics

Stay Up To Date

Newsletter Signup

EE Training Center Classrooms

“ee

“ee

“ee

“ee

Recent Articles

  • New Vishay Semiconductors increase efficiency of high-frequency applications
  • TI launches industry’s top wireless battery-management solution
  • AVX releases new series of embedded, highly sensitive Wi-Fi antennas
  • Nuvoton offers a secure storage MCU for multi-segments
  • Refrigerator Compressor Design Achieves High Energy Efficiency Ratings Using a Digital Signal Controller (DSC)
...

RSS EDABOARD.com Discussions

  • Rippe current rating of aluminium electrolytic capacitor is very low.
  • Why do some op amps have a higher GBW than what the unity gain-bandwidth is?
  • Stacked Diodes ?
  • dsPIC33f ADC reading voltage help
  • What the best way to store data of size ( 90,000 * 32) bit (taken from a text file) using VHDL?

RSS Electro-Tech-Online.com Discussions

  • Engine Temperature using an AD590 on the Oil Pressure Wire to the engine
  • Automotive 6 Volt Generator Transistor Voltage Regulator
  • Jon's Imaginarium - Microchip FilterLab Program and Graph Paper Printer Program by Dr. Philippe Marquis
  • Touch circuit sound, led. 555 timer
  • Dust extractor remote switch
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2021 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 | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Circuit Design
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Components
  • Articles
    • EG Blogs
    • Insight
    • Invention Stories
    • How to
    • What Is
    • News
      • EE Design News
      • DIY Reviews
      • Guest Post
      • Sponsored Content
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key 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
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • Video
    • White Papers
    • Webinars
  • EE Learning Center
  • Women in Engineering