Menu

I need a fast way to parse a GPS data message

2020-08-18
2020-08-18
  • Harley Burton

    Harley Burton - 2020-08-18

    I am looking for a way to parse a NMEA GPS message. Eadch message has 14 comma delimited fields. These fields may vary in length by one or two characters, for example, the latitude dcan be from 6 digits to 9 digits (ASCII). It would be nice if I could declare a structure and have the incoming string be split into each field as it is in Basics that support disk drives and also in C.

    For Example:

    dim GPSData as struct
    dim msgDesig as string(6)
    dim msgTime as string(6)
    dim msgLat as string(9)
    dim msgLon as string(9)
    .
    .
    .
    end struct

    That when I receive a string via the serial port, it would automatically be loaded into this structure using the comma to delimit each field.

    Is this anything that will do this automatically or do I have to break it out manually? If I do, is there a conditional "MID" function that works a little different than what I see in the manual. What would be good there is a function that looks like MID(<stringname>, <start character="">, <ending condition="">) where ending condition could be searching for a delimiter, i.e. ",".</ending></start></stringname>

    Thanks,

    Harley
    N5BFB

     
  • Anobium

    Anobium - 2020-08-18

    Insight and an idea.

    Insight. No structures - so, you need to use other methods.

    Idea. I would use the ring buffer. Using the ring buffer look for start character and end character then loading into your variables.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.