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 / how to merge TL0 and TH0 value to an integer

how to merge TL0 and TH0 value to an integer

|

Microcontroller › 8051 › how to merge TL0 and TH0 value to an integer

  • This topic has 2 replies, 3 voices, and was last updated 12 years, 9 months ago by lakshmeesha.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • May 29, 2013 at 8:55 am #2452
    ahsan
    Participant

    helo sir, 

     

     

     i want to merge LSB and MSB value of an unsigned integer with timer low and high byte..

     

    TL0=0x00;

    TH0=0x00;

    unsigned int a;

     

    is it possible?

     

    a=0xTL0TH0;

    May 29, 2013 at 12:40 pm #9861
    Sagar
    Participant

    unsigned int a;

    a=TH0;

    a<<=8; //left shift higher byte by 8 bits

    a|=TL0; //merge lower bytes using OR

    May 31, 2013 at 8:05 pm #9875
    lakshmeesha
    Participant

    in one line,,,

     

    a=(TH1<<8)+TL1; //shifting TH1 left to 8 bit, adding TL1

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

RSS Recent Posts

  • Phone to op amp circuit? March 14, 2026
  • ESP32 battery-powered IoT project March 14, 2026
  • Want Thermal Camera with Fixed Thermal Span option March 14, 2026
  • Very Curious Issue With DS3231 RTC Clock March 14, 2026
  • Fender rumble 100 base amp, power, light and overdrive light flash repeatedly when power turned on no output March 14, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 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