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 / explain about temprature project code

explain about temprature project code

|

Microcontroller › 8051 › explain about temprature project code

  • This topic has 1 reply, 2 voices, and was last updated 12 years, 7 months ago by AJISH ALFRED.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • January 2, 2014 at 8:29 am #2792
    pedram
    Participant

    hi,

    I have a problem in code of “ Celsius and Fahrenheit scale digital thermometer using 8051 microcontroller (AT89C51)” project in these line:

     

    …….

    test_final=test_intermediate3;

        lcd_cmd(0xc1);        //Setting  cursor to first position of first line

        delay(2);

        lcd_data_string(“TEMP:”);

        s=test_final/100;

        test_final=test_final%100;

        lcd_cmd(0xc8);

        if(s!=0)

        lcd_data(s+48);

        else

        lcd_cmd(0x06);

        s=test_final/10;

        test_final=test_final%10;

        lcd_data(s+48);

        lcd_data(test_final+48);

        lcd_data(0);

        lcd_data(‘c’);

        lcd_data(‘ ‘);

        delay(2);

    ……

     

    please explain bold lines of code and why plus 48 to the results?

    January 4, 2014 at 7:12 pm #10825
    AJISH ALFRED
    Participant

    Hi,

    48 is added to any sigle digit value to get its ascii value, because ascii value of 0 is 48.

    To get ascii value of 1, use 1+48

    To get ascii value of 2, use 2+48

     

  • 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

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 Arrowfly 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 Arrowfly
Privacy Policy | Advertising

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