View Single Post
  #77   Spotlight this post!  
Unread 13-06-2002, 20:43
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 SuperDanman


Hmm, well what happens if you loose one of those 24 bytes... it'll be that your 24th byte will actually be the first byte of the new packet... how does your way protect against this?
You won't. PC serial ports use buffers to store data in. Once you begin the read, you will get 26 continuous bytes. On the other hand, if the buffers overflow between read operations, you might loose a byte or two. Even if you do, by some mysterious fluke of Windows, loose a byte from the middle of a 24-byte read, checking for the start of the packet on each loop will make sure it corrects itself.
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php