Connect with us

Serial port synchronization(Buffer threshold or time interval?)

Discussion in 'Electronic Basics' started by Suraj, Apr 26, 2004.

Scroll to continue with content
  1. Suraj

    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
     
  2. 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.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-