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, 1 month 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

  • Wierd makita battery July 13, 2025
  • using a RTC in SF basic July 13, 2025
  • Is AI making embedded software developers more productive? July 13, 2025
  • ac current limiting July 13, 2025
  • I Wanna build a robot July 13, 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