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

Interfacing ADC0804 with Serial port (RS232) using 8051 micocontroller (AT89C51)- (Part 23/45)

By Himanshu Choudhary

This circuit demonstrates the principle and operation of collecting data from ADC0804 and sending it to PC via serial communication using 8051 microcontroller (AT89C51). The circuit is divided into three parts: ADC, Controller and Serial Port. This circuit can be used as an intermediate in many applications.Click to  read more about Serial Port(RS232).

 


ADC0804 which is an 8-bit resolution ADC has only one input channel connected to variable resistance (preset) to give the analog input. In place of preset, analog input from a sensor can also be used. (Refer interfacing ADC0804 with AT89C51)

 

 

 
The output pins of the ADC are connected to port P1 of the microcontroller. Write (WR) pin 3 is connected to P2.0 i.e. pin 21 of controller. Read (RD) pin 2 is connected to P2.1 i.e. pin 22 of controller. Interrupt (INTR) pin 5 is connected to P2.2 i.e. pin 23 of controller.
 
The data coming on the port P1 is stored in the SBUF register of the MCU. The serial communication of controller with PC is done using the TxD pin 11 of the microcontroller AT89C51. The IC Max 232 is used to ensure compatibility between controller and serial port (Refer serial port interfacing through controller).
 
The program continuously monitors the output of ADC0804 and transmits it to the serial port. The input to the ADC is supplied through a preset. When the value of preset changes, the corresponding output changes and is displayed on the hyper-terminal.
 
Hyper Terminal shows character corresponding to the ASCII values 0-255 (Refer serial port interfacing through controller for hyper-terminal settings).

 

 

Project Source Code

###

// Program to read the values of ADC and serially tranmitting it to PC.
#include<reg51.h>
sbit wr= P2^0;        // Write pin. It is used to start the conversion.
sbit rd= P2^1;        // Read pin. It is used to extract the data from internal register to the output pins of ADC.
sbit intr= P2^2;        // Interrupt pin. This is used to indicate the end of conversion. It goes low when conversion is complete.

void transmit()        // Function for serial tranmission of data.
{
    SBUF=P1;
    while(TI==0);
    TI=0;
}

void delay(unsigned int msec )        // The delay function provides delay in msec.
{
    int i ,j ;
    for(i=0;i<msec;i++)
        for(j=0; j<1275; j++);
}

void adc()        //Function to read the values from ADC and tranmit serially.
{
    rd=1;
    wr=0;
    delay(2);
    wr=1;
    while(intr==1);
    rd=0;
    transmit();
    delay(2);
    intr=1;
}

void init()        // Intialize timer 1 in mode 2 for serial transmission. The baud rate is set to 9600bps.
{
    TMOD=0x20;
    TH1=0xFD;
    SCON=0x50;
    TR1=1;
}

void main()
{
    P1=0xff;        // Declare P1 as input port.
    init();
    while(1)
    {
        adc();
    }
}

###


Circuit Diagrams

Circuit-Diagram-of-Interfacing-ADC0804-with-Serial-port-RS232-using-8051-micocontroller-AT89C51

Project Components

  • ADC0804
  • AT89C51 Microcontroller
  • MAX232

Project Video


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

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

  • 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)

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

  • MAX5389 resetting by noise
  • Verilog/SV: Using an array as a set of individual registers and not RAM
  • the mysterious emitter follower
  • Diagnosing a fault on a 18volt lithium Ion charger
  • electrode-skin impedance mismatch

RSS Electro-Tech-Online.com Discussions

  • Relaxation oscillator with neon or...
  • LCD display on PICDEM 2 Plus board
  • software PWM
  • Positive and negative sides of voltage source
  • Cordless vacuum cleaner problem
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