View Single Post
  #2   Spotlight this post!  
Unread 29-01-2003, 22:59
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
Quote:
Originally posted by mjt902
Once again you correct me!!! Oh, I'm lazy anyway but thanks for the free code. Only one question have I:
where'd you get the 8 from in SELECT(loopCntHigh<<8 + loopcnt)

i think you and i are on the same page (only i'm on a different plane) , and its great learning from you!!!
The 8 will shift it left by 8 bits, leaving enough space for the byte (8-bits) to fill in the newly created free space.

Here's an example:

Assume loopCntHigh is 3 (0011 in binary), meaning we've looped through 256 values of loopCnt 3 times.
Assume loopCnt is 199 (11000111).

Then: loopCntHigh<<8=001100000000
Add loopCnt: 001111000111, which is 967. This makes sense as 256*3+199=967.

Does that make any sense? Bit shifting operations are always messy, but sometimes they are the easiest solution to problems like this (a single number spanning multiple variables).
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php