8051 – ADC0804 Interfacing

In this tutorial we will interfacing Temperature Sensor (LM35) with 8051 using ADC0804. ADC0804 interfacing with 8051. ADC0804 is a 8-bit ADC.

ADC0804 interfacing with 8051


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. convert the physical characteristics into electrical signals that are analog in nature.

Why we are using ADC for 8051 Microcontroller?

Well. 8051 doesn’t has inbuilt ADC. So we have to use external ADC. There are many ADCs available.

  • ADC 0804
  • ADC 0808

In this post we will see ADC 0804. In our next post we will see ADC0808. Let’s Start.

ADC 0804

The ADC0804 is a converter from analog to digital 8 bits. This ADC0804 has only one analog input channel with a digital output eight bits that can mostra 256 values ​​of different measures. The step size is adjusted by setting the reference voltage in pin9 the reference input voltage can be adjusted to allow encoding any smaller range for the entire 8-bit resolution analog voltage. When the voltage reference pin is not connected to the ADC0804, the reference voltage defaults to the operating voltage, ie, Vcc. The step size is 19.53mV 5V (5V / 255), ie, for every increase of 19.53mV at the analog input, the output varies by 1 unit. To establish a determined voltage level as the reference value, this pin is connected to half the voltage. For example, to establish a reference 2V (Vref) is connected to 1V pin9 (Vref / 2), thereby reducing the step size to 7.84mV (2V / 255).
ADC0804 also need a clock to operate. The conversion time of the analog value to a digital value depends on the clock source. An external clock can be given at the Clock IN pin. ADC 0804 also has an inbuilt clock which can be used in absence of external clock. A suitable RC circuit is connected between the Clock IN and Clock R pins to use the internal clock.


  • 0V to 5V analog input voltage range with single 5V supply
  • Compatible with microcontrollers, access time is 135 ns
  • Easy interface to all microprocessors
  • Logic inputs and outputs meet both MOS and TTL voltage level specifications
  • Works with 2.5V (LM336) voltage reference
  • On-chip clock generator
  • No zero adjust required
  • 0.3[Prime] standard width 20-pin DIP package
  • Operates ratio metrically or with 5 VDC, 2.5 VDC, or analog span adjusted voltage reference
  • Differential analog voltage inputs

Pin Diagram

Pin Description

How to use the ADC0804?

  • Make Cs(chip select) low(0) to activate the ic. Here we are directly connecting that CS into Ground instead of connecting into 8051.
  • Make WR(write) pin low (0).
  • Make RD(read) pin high (1).
  • Make WR(write) pin high (1) after some delay small delay//This low to high impulse at WR pin starts your conversion.
  • Now check the INTR(interrupt) pin if it is high(1) conversion is runing if it is low(0) the conversion is over.
  • Make RD=low(0) .

This will bring the converted value to the 8 data output pins of ADC 0804. 

Temperature Sensor (LM35)

The LM35 series are precision integrated-circuit temperature sensors, whose output voltage is linearly proportional to the Celsius (Centigrade) temperature. The LM35 thus has an advantage over linear temperature sensors calibrated in ˚ Kelvin, as the user is not required to subtract a large constant voltage from its output to obtain convenient Centigrade scaling. The LM35 does not require any external calibration or trimming to provide typical accuracies of ±1 ⁄4˚C at room temperature and ±3 ⁄4˚C over a full −55 to +150˚C temperature range. Low cost is assured by trimming and calibration at the wafer level. The LM35’s low output impedance, linear output, and precise inherent calibration make interfacing to readout or control circuitry especially easy. It can be used with single power supplies, or with plus and minus supplies. As it draws only 60 µA from its supply, it has very low self-heating, less than 0.1˚C in still air. The LM35 is rated to operate over a −55˚ to +150˚C temperature range, while the LM35C is rated for a −40˚ to +110˚C range (−10˚ with improved accuracy). The LM35 series is available packaged in hermetic TO-46 transistor packages, while the LM35C, LM35CA, and LM35D are also available in the plastic TO-92 transistor package. The LM35D is also available in an 8-lead surface mount small outline package and a plastic TO-220 package.


  • Calibrated directly in ˚ Celsius (Centigrade)
  • Linear + 10.0 mV/˚C scale factor
  • 0.5˚C accuracy guarantee able (at +25˚C)
  • Rated for full −55˚ to +150˚C range
  • Suitable for remote applications
  • Low cost due to wafer-level trimming
  • Operates from 4 to 30 volts
  • Less than 60 µA current drain
  • Low self-heating, 0.08˚C in still air
  • Nonlinearity only ±1 ⁄4˚C typical
  • Low impedance output, 0.1 Ω for 1 mA load


Now we will interface LM35 with MCS51 to monitor the Temperature on LCD display.

Connection Diagram


  • RS                : P0.5
  • RW              : P0.6
  • EN               : P0.7
  • Data Lines : P2


  • RD        : P0.0
  • WR       : P0.1
  • INTR    : P0.2
  • Output : P1

Temperature Sensor:

Output of Temp sensor – Vin+ (6)



You can download this code on Github… To download Click Here.


[ Please find the output image Here ]

In our tutorial we are interfacing Temperature Sensor with 8051 by using ADC0804. Like this you can interface any analog sensor. If you have any doubts mail us or comment below.

0 0 vote
Article Rating
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

1 Comment
Newest Most Voted
Inline Feedbacks
View all comments
shah utsav
shah utsav
May 9, 2018 4:37 AM

i ask you, now this time adc 0804 ic is not working condition in market bcz i purchase 5 to 10 ic but still not working

Would love your thoughts, please comment.x
%d bloggers like this: