Shop OBEX P1 Docs P2 Docs Learn Events
Parse NMEA sentences — Parallax Forums

Parse NMEA sentences

ArchiverArchiver Posts: 46,084
edited 2003-12-17 18:02 in General Discussion
Does anyone know the format to parse NMEA sentences for reading
serial GPS outputs to serial LCD'S Thanks

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-12-17 05:16
    This article should help:

    http://www.parallax.com/dl/docs/cols/nv/vol3/col/83.pdf

    It specifically covers NMEA $GPMRC string receipt and parsing with a
    BS2p.

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: mikey_118@y... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=UTRmt4RLvo_CBJWpr5RxR-4szYwajbTOWShDT3NpGEaFXVwmXwhz53D8-g1kNFl16p1ufKonmz0vgbU]mikey_118@y...[/url
    Sent: Tuesday, December 16, 2003 9:50 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Parse NMEA sentences


    Does anyone know the format to parse NMEA sentences for reading
    serial GPS outputs to serial LCD'S Thanks


    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject
    and Body of the message will be ignored.


    Yahoo! Groups Links

    To visit your group on the web, go to:
    http://groups.yahoo.com/group/basicstamps/

    To unsubscribe from this group, send an email to:
    basicstamps-unsubscribe@yahoogroups.com

    Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/




    This message has been scanned by WebShield. Please report SPAM to
    abuse@p....
  • ArchiverArchiver Posts: 46,084
    edited 2003-12-17 07:06
    There are several methodsyou can use depending on whether you want a generic
    routine which can be used for any device's output (most effort) of if you
    simply want to write something simple that will get specific strings from a
    specific receiver.

    What do you want to accomplish?

    You might look up Jon's N&V article from earlier in the year (I think) where
    he covers a fairly entailed method for a Garmin receiver (again, AFAIR)


    Does anyone know the format to parse NMEA sentences for reading
    serial GPS outputs to serial LCD'S Thanks
  • ArchiverArchiver Posts: 46,084
    edited 2003-12-17 18:02
    Hi Mikey,

    This is how i read NMEA data from a GPS module:

    GPSQuality var byte ' GPS quality indicator

    TimeData var byte(4) ' UTC time data
    LatitudeData var byte(4) ' latitude data
    LongitudeData var byte(4) ' longitude data
    AltitudeData var word ' altitude data

    ' GPSReadData - Reads NMEA data from the GPS module
    '
    GPSReadData: ' Set the default GPS data quality
    GPSQuality = 0

    ' Get NMEA data from the GPS module...
    SERIN 0,16572,2000,GPSReadDataFailed,[noparse][[/noparse]WAIT("$GPGGA"), SKIP 1, DEC2
    TimeData(0), DEC2 TimeData(1), DEC2 TimeData(2), SKIP 1, DEC2 TimeData(3),
    SKIP 2, DEC2 LatitudeData(0), DEC2 LatitudeData(1), SKIP 1, DEC2
    LatitudeData(2), SKIP 3, LatitudeData(3), SKIP 1, DEC3 LongitudeData(0),
    DEC2 LongitudeData(1), SKIP 1, DEC2 LongitudeData(2), SKIP 3,
    LongitudeData(3), SKIP 1, DEC1 GPSQuality, SKIP 8, DEC AltitudeData]

    GPSReadDataFailed: RETURN

    If valid GPS data is received then the value of the GPSQuality variable will
    be non-zero.

    And this is how i display NMEA data on a two line LCD:

    ' DisplayPosition - Displays the position on the LCD panel
    '
    DisplayPosition:
    SEROUT 0,16468,[noparse][[/noparse]$FE, 128, "LAT ", DEC2 LatitudeData(0), %11011111, DEC2
    LatitudeData(1), ".", DEC2 LatitudeData(2), 39, " ", LatitudeData(3)]
    SEROUT 0,16468,[noparse][[/noparse]$FE, 192, "LNG ", DEC3 LongitudeData(0), %11011111, DEC2
    LongitudeData(1), ".", DEC2 LongitudeData(2), 39, " ", LongitudeData(3)]
    RETURN

    I hope this helps.

    Best regards,

    Russell Warburton
    email: russell@w...
    website: http://www.warburtech.com
    telephone: +44 (0)7814 044 754
    Original Message
    From: <mikey_118@y...>
    To: <basicstamps@yahoogroups.com>
    Sent: Wednesday, December 17, 2003 3:50 AM
    Subject: [noparse][[/noparse]basicstamps] Parse NMEA sentences


    > Does anyone know the format to parse NMEA sentences for reading
    > serial GPS outputs to serial LCD'S Thanks
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Yahoo! Groups Links
    >
    > To visit your group on the web, go to:
    > http://groups.yahoo.com/group/basicstamps/
    >
    > To unsubscribe from this group, send an email to:
    > basicstamps-unsubscribe@yahoogroups.com
    >
    > Your use of Yahoo! Groups is subject to:
    > http://docs.yahoo.com/info/terms/
    >
    >
    >
Sign In or Register to comment.