- This topic has 2 replies, 3 voices, and was last updated 12 years, 1 month ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.
|
Microcontroller › 8051 › how to merge TL0 and TH0 value to an integer
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;
unsigned int a;
a=TH0;
a<<=8; //left shift higher byte by 8 bits
a|=TL0; //merge lower bytes using OR
in one line,,,
a=(TH1<<+TL1; //shifting TH1 left to 8 bit, adding TL1