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 ADC0808 with Serial port (RS232) using interrupt clock from 8051 microcontroller (AT89C51)- (Part 27/45)

By Himanshu Choudhary January 1, 2013

In many applications data collected from multiple sensors is transmitted to PC for display or further analysis. The conversion of data from analog to digital form is done using an ADC. The digital data from the ADC is transferred to the computer using serial port. This circuit demonstrates the principle and operation of interfacing an ADC0808 with serial port of PC using the microcontroller AT89C51. The circuit is divided into three parts: ADC, controller and serial port. This circuit can be used as an intermediate circuit in many applications.

 

 

 


 

ADC0808 which is an 8-bit resolution ADC has eight input channels i.e., it can take a maximum of eight analog inputs. The circuit uses the first analog input pin to take the analog input signals from the preset.

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. Every time the timer completes the counting, pin P1.2 toggles its state. (Refer interfacing ADC0808 using clock from AT89C51).
The output pins of ADC are connected to the port P0 of the controller. The pin10 of the ADC is connected to pin8 (P1.7) of the controller for clock input. ALE, pin 22 of the ADC is connected to pin 1 (P1.0) of controller. OE, pin9 of the ADC is connected to pin 4 (P1.3) of controller. SC, pin6 of the ADC is connected to pin 2 (P1.1) of the controller. EOC, pin7 is connected to pin 3 (P1.2) of controller. Selector pins A (25), B (24) and C (24) of ADC are connected to the pins 4, 5 and 6 of the controller respectively.  
The port P0 is continuously scanned and the output of the ADC is transmitted via serial port. The value of the port P0 is loaded in the SBUF register and sent via TxD (pin11) of the controller. Hyper Terminal shows character corresponding to the ASCII values 0-255 (Refer serial port interfacing with AT89C51 for hyper terminal settings).

 

 

Project Source Code

###

// Program to read ADC 0808. The output pins are connected to serial port. 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;//P0 port
void transmit()    //serial port transmission
{
SBUF=input_port;
while(TI==0);
TI=0;
}
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;

TH1=0xFD;  //timer1 setting for serial communication
SCON=0x50;
TR1=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;
transmit();
delay(2);
oe=0;


  }

}

###

 


Circuit Diagrams

Circuit-Daigram-Interfacing-ADC0808-Serial-port-RS232-interrupt-clock-8051-microcontroller-AT89C51

Project Components

  • AT89C51 Microcontroller
  • IC ADC0808
  • MAX232

Project Video


Filed Under: 8051 Microcontroller
Tagged With: 8051, adc, clock, interrupt, microcontroller, rs232, serial port
 

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: 5G Technology
This Tech Toolbox covers the basics of 5G technology plus a story about how engineers designed and built a prototype DSL router mostly from old cellphone parts. Download this first 5G/wired/wireless communications Tech Toolbox to learn more!

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

  • The Analog Gods Hate Me
  • Battery Deep Discharge – IC Workarounds?
  • Safe Current and Power Density Limits in PCB Copper(in A/m² and W/mÂł) simulation
  • Why so few Phase shift full bridge controllers?
  • Apc 650 upa

RSS Electro-Tech-Online.com Discussions

  • Simple LED Analog Clock Idea
  • The Analog Gods Hate Me
  • Wideband matching an electrically short bowtie antenna; 50 ohm, 434 MHz
  • PIC KIT 3 not able to program dsPIC
  • Parts required for a personal project

Featured – LoRa/LoRaWan Series

  • What is the LoRaWAN network and how does it work?
  • Understanding LoRa architecture: nodes, gateways, and servers
  • Revolutionizing RF: LoRa applications and advantages
  • How to build a LoRa gateway using Raspberry Pi
  • How LoRa enables long-range communication
  • How communication works between two LoRa end-node devices

Recent Articles

  • Tria modules integrate edge AI processing with multi-core processors
  • pSemi introduces RF switch with 52 dBm PMAX,PEAK and 90-dBm IIP3 linearity
  • XP Power launches 1.3 kW power supply with 58.9 W/cmÂł density
  • How to enable Wi-Fi provisioning in ESP32-based IoT products
  • Amphenol RF introduces FAKRA to SMA adapters with 4 GHz operating frequency

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