--- bdrmachine <[EMAIL PROTECTED]> wrote:

> Can someone give me a C example of how to combine 2
> unsigned chars (msb 
> and lsb) and store as a unsigned int (L)? It seams
> the technique I'm 
> using is more involved then it should be. Would "L=
> msb<<8 + lsb;" 
> work?  I'm working on a program for a 8 bit
> microcontroller. Unsigned 
> char's are 8 bits long and unsigned int's are 16
> bits.
> 
> Thanks
> Brian  
> 
> 
If you tak msb which is 8 bits and shift it 8 bits,
you now have 8 zeros.  In keeping with your logic, you
could do:
L = msb;
L = L << 8 + lsb;

Ray


       
____________________________________________________________________________________
Moody friends. Drama queens. Your life? Nope! - their life, your story. Play 
Sims Stories at Yahoo! Games.
http://sims.yahoo.com/  

Reply via email to