EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • 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
  • Advertise
You are here: Home / Topics / LM35 temperature sensor interfacing with 80S52

LM35 temperature sensor interfacing with 80S52

|

Microcontroller › 8051 › LM35 temperature sensor interfacing with 80S52

  • This topic has 1 reply, 2 voices, and was last updated 12 years, 4 months ago by AJISH ALFRED.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • February 19, 2013 at 9:45 am #2117
    prajwal
    Participant

    hi friends,

     

    I am interfacing LM35 sensor with 8052. the code goes like this,

     

     

    #include<reg52.h>
    sbit ale = P2^4;
    sbit oe = P2^5;
    sbit sc = P2^6;
    sbit eoc = P2^7;
    sbit add_a = P2^0;
    sbit add_b = P2^1;
    sbit add_c = P2^2;
    sfr result = P1;
    void DelayMs(unsigned int count);
    void main()
    {
    unsigned char value;
    result=0xff;
    eoc=1;
    ale=0;
    oe=0;
    sc=0;
    while(1)
    {
    add_c=0;
    add_b=0;
    add_a=1;
      DelayMs(1);
    ale=1;
    DelayMs(1);
    sc=1;
    DelayMs(1);
    ale=0;
    sc=0;
    while(eoc==1);
    while(eoc==0);
    oe=1;
    DelayMs(1);
    value=result;
    oe=0;
    }
    }
     
    void DelayMs(unsigned int count)
    {  // mSec Delay @ 11.0592 Mhz
        unsigned int i;                            
        while(count) {
            i = 115;
                    while(i>0) i–;
            count–;
        }
    }
     
     
    At the end of the code i need to convert the adc output to temperature. pls help i have no idea of how to convert
    February 19, 2013 at 1:50 pm #9161
    AJISH ALFRED
    Participant

    Hi,

    The best method is touse the printf function where you can make use of the %d option to convert the integer to string.

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

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

Stay Up To Date

Newsletter Signup
EngineersGarage

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 | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • 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
  • Advertise