Serial port synchronization(Buffer threshold or time interva

S

Suraj

Guest
Hi All,
I am trying to read a *variable length* string (from a Garmin GPS, @1Hz) on
my PC serial port using the MSCOMM Control in VB. Now, I'm stumped by this:
The COMM control can generates a "recieve Event" when the specified
"Threshold" of characters in the buffer is met. Now my string is variable
length, If I specify a threshold that's less (I can't know!) I get multiple
"Recieve Events" and my string is cut into many pieces. While I know that
the GPS sends the string at 1 sec Intervals, but how do I syncronize with
this? I get half-cut strings if I start reading from program loadup.

I know there must be a simple handshaking technique that I don't know about.

Many thanks
 
On Mon, 26 Apr 2004 15:57:05 +0530, "Suraj" <surjones@yahoo.com>
wrote:

Hi All,
I am trying to read a *variable length* string (from a Garmin GPS, @1Hz) on
my PC serial port using the MSCOMM Control in VB. Now, I'm stumped by this:
The COMM control can generates a "recieve Event" when the specified
"Threshold" of characters in the buffer is met. Now my string is variable
length, If I specify a threshold that's less (I can't know!) I get multiple
"Recieve Events" and my string is cut into many pieces. While I know that
the GPS sends the string at 1 sec Intervals, but how do I syncronize with
this? I get half-cut strings if I start reading from program loadup.

I know there must be a simple handshaking technique that I don't know about.

Many thanks
I assume you are receiving NMEA-0183 data from the GPS.

You need to read the incomming data a character at a time, and look
for the "$" that identifies the start of an NMEA-0183 sentence,
discarding characters til you find it. You can then discard the next
two characters (talker ID), and look at the next three (sentence ID)
to decide what to do with the remainder of the sentence.



--
Peter Bennett VE7CEI
email: peterbb4 (at) interchange.ubc.ca
GPS and NMEA info and programs: http://vancouver-webpages.com/peter/index.html
Newsgroup new user info: http://vancouver-webpages.com/nnq
 

Welcome to EDABoard.com

Sponsor

Back
Top