Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • 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
    • White Papers
    • Webinars
  • EE Learning Center
  • Women in Engineering

How to interface ADC0808 using clock from 8051 microcontroller (AT89C51)- (Part 25/45)

By Himanshu Choudhary

An analog-to-digital converter is a device which converts continuous signals to discrete digital numbers. Typically, an ADC is an electronic device that converts an input analog voltage (or current) to a digital number proportional to the magnitude of the voltage or current. This circuit demonstrates the interfacing of ADC0808 using 8051 microcontroller (AT89C51). The digital output is taken on a set of LEDs. This is an intermediate circuit which finds several applications. This circuit depicts a way to provide the external clock, required for ADC, from the microcontroller.

 

 

 


Analog-to-digital converters are among the most widely used devices for data acquisition. Digital computers use binary values, but in physical world everything is analog. Therefore, we need an analog-to-digital converter to translate these analog signals to digital signals.

 

 

An ADC has n-bit resolution where n can be 8,10,12,16 etc. The ADC chips are either parallel or serial. Parallel ADC has 8 or more pins dedicated to bring out the binary data. ADC0808 is such a parallel ADC with 8-bit resolution.
 
ADC0808 has 8 input channels, i.e., it can take eight analog signals. To select these input channels, three select pins are to be configured. In this circuit the microcontroller AT89C51 is used to send the control and enabling signals to ADC.
 
In ADC Vref (+) (pin12) and Vref (-) (pin16) are used to set the reference voltage. If Vref (-) is GND and Vref (+) = 5V, the step size is 5V/256=19.53mV. ADC0808 has 8 input pins IN0-IN7 (pins 1-5 & 26-28). To select an input pin, there are three selector pins A, B and C (pin 25, 24 & 23, respectively). ALE (Address latch enable, pin22) is given a low to high pulse to latch in the address. SC (Start conversion, pin6) instructs the ADC to start the conversion. When a low to high pulse is given to this pin ADC starts converting the data. EOC (end of conversion, pin7) is an output pin and goes low when the conversion is complete and ready to be picked up, and OE(output enable, pin9) is given a low to high pulse to bring the converted data from the internal register of ADC to the output pins. Pin11 is Vcc and pin13 is GND. Here we are using external clock for clock input (pin 10).
 
The connection of the ADC with the microcontroller can be seen on the circuit diagram. ALE (pin22) of ADC is connected to P1.0 of controller AT89C51. Selector pins A, B, C (pins 25, 24 & 23) of ADC are connected to P1.4, P1.5 & P1.6 pins of microcontroller, respectively. SC (pin6) of ADC is connected to P1.1 of controller. EOC (pin7) of ADC is connected to P1.2 of microcontroller and OE (pin9) of ADC is connected to P1.3 of microcontroller. Output of ADC goes to port P0 (pins 32-39) of controller. AT89C51 The output is sent to the port P2 (pins 21-28) of controller which is connected to eight LEDs.
 
The program continuously scans the input of ADC and displays the output on the output port P2. By varying the input of ADC, output of ADC changes and the change is reflected in the glowing pattern of LEDs connected to the port.
 
To provide clock input to the ADC, Timer0 is used in interrupt enabled mode to generate a clock of frequency 500 KHz.  To enable the Timer0 in interrupt enable mode, the register IE is loaded with the value 0x82. (Refer Timer programming with 8051) Every time the Timer completes the counting, pin P1.7 toggles its state.
 

 

 

Project Source Code

###

// Program to test ADC 0808. The output pins are connected to LED's. Controller interrupt is used to generate the clock for driving the ADC 0808.
#include<reg51.h>
sbit ale=P1^0;  //address latch enable
sbit oe=P1^3;  //output enable
sbit sc=P1^1;  //start conversion
sbit eoc=P1^2;  //end of conversion
sbit clk=P1^7;  // clock

sbit ADD_A=P1^4;  // Address pins for selecting input channels.
sbit ADD_B=P1^5;
sbit ADD_C=P1^6;
sfr input_port=0x80;
sfr output_port=0xA0;

void timer0() interrupt 1  // Function to generate clock of frequency 500KHZ using Timer 0 interrupt.
{
clk=~clk;
}

void delay(unsigned int count)  // Function to provide time delay in msec.
{
int i,j;
for(i=0;i<count;i++)
  for(j=0;j<1275;j++);
}

void main()
{
eoc=1;
input_port=0xFF;
ale=0;
oe=0;
sc=0;
TMOD=0x22;  //timer0 setting for generating clock of 500KHz using interrupt enable mode.
TH0=0xFD;
IE=0x82;
TR0=1;
while(1)
{
  ADD_C=0;  // Selecting input channel 2 using address lines
  ADD_B=0;
  ADD_A=1;
  delay(2);
  ale=1;
  delay(2);
  sc=1;
  delay(1);
  ale=0;
  delay(1);
  sc=0;
  while(eoc==1);
  while(eoc==0);
  oe=1;
  output_port=input_port;
  delay(2);
  oe=0;
}
}

###

 


Circuit Diagrams

Circuit-Diagram-of-How-to-interface-ADC0808-using-clock-from-8051-microcontroller-AT89C51

Project Components

  • AT89C51 Microcontroller
  • IC ADC0808
  • LED

Project Video


Filed Under: 8051 Microcontroller
Tagged With: 8051, adc, dip switch, led, microcontroller
 

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.

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!


Featured Tutorials

  • Designing Gate Driver Circuit and Switching Mechanism for Modified Sine Wave Inverter – (Part 9/17)
  • Completing Modified Sine Wave Inverter Design with Full Bridge Circuit and Step Up Transformer – (Part 10/17)
  • Designing an Offline UPS – Part (12 /17)
  • How to reduce Switching Time of a Relay – (Part 15/17)
  • Testing MOSFET – (Part 16/17)
  • Driving High Side MOSFET using Bootstrap Circuitry – (Part 17/17)

Stay Up To Date

Newsletter Signup

Sign up and receive our weekly newsletter for latest Tech articles, Electronics Projects, Tutorial series and other insightful tech content.

EE Training Center Classrooms

EE Classrooms

Recent Articles

  • Infineon offers DC-DC controller for full LED headlamps without a microcontroller
  • Vishay launches new high-precision, thin-film wraparound chip resistor
  • STMicroelectronics’ common-mode filters ensure signal integrity in serial interfaces
  • Renesas’ RA Family microcontrollers earn CAVP certification for cryptographic algorithms
  • MicroPython: Serial data communication in ESP8266 and ESP32 using UART

Most Popular

5G 555 timer circuit 8051 ai Arduino atmega16 automotive avr dc motor display Electronic Part Electronic Parts Fujitsu ic infineontechnologies integratedcircuit Intel IoT ir lcd ldr led maximintegratedproducts microchip microchiptechnology Microchip Technology microcontroller microcontrollers mosfet motor powermanagement Raspberry Pi remote renesaselectronics Research robot samsung semiconductor sensor software STMicroelectronics switch Technology vishayintertechnology wireless

RSS EDABOARD.com Discussions

  • Problem in opening Orcad schematic file
  • Boost converter, 3W...shielded or unshielded inductor?
  • Switching frequency data not available
  • PHY to MAC communication: issue with SMI (MDIO+MDC) bus
  • Looking for miniature shaded pole motors

RSS Electro-Tech-Online.com Discussions

  • Background of Members Here
  • Opamp ciruit
  • DIY Mini 12v Router UPS malfunction
  • How can a 13 bit number represent 16 bit number?Or why is fragmentation offset multiple of 8?
  • Best home PCB printer and software for prototyping?
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 © 2022 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
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • 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
    • White Papers
    • Webinars
  • EE Learning Center
  • Women in Engineering