Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/27/01 14:43
Read: times


 
#11191 - RE: Low and High Byte into Integer
Peter,

The following is an example of how to directly assign 2 bytes into integer variable using a union.


union
{
char chByte[2];
unt uWord;
} sData;


sData.chByte[1] = TL0;
sData.chByte[0] = TH0;

count16 = sData.uWord;

Paul

PS. Sorry for the last posting (first time user of this forum).



Peter Berec wrote:
-------------------------------
What is the more efficient way to assign directly 2 bytes into integer variable?
For example, the TH0 and TL0 registers into integer count16:

unsigned integer count16;
count16 = TL0 + 255*TH0;

List of 5 messages in thread
TopicAuthorDate
Low and High Byte into Integer            01/01/70 00:00      
RE: Low and High Byte into Integer            01/01/70 00:00      
RE: Low and High Byte into Integer            01/01/70 00:00      
RE: Low and High Byte into Integer            01/01/70 00:00      
RE: Low and High Byte into Integer            01/01/70 00:00      

Back to Subject List