Parse GPS data from your PACs 232 port

Hi All,

The attached PAC Control Basic 8.0 chart (can be imported into any 8.0 basic or better strategy) to parse GPS data on a RS-232 port. It shows how to make use of the EOM (end of message) character when receiving strings using a communication handle, and a couple of ways to parse data in a string table.

When there’s a LOT of data to be received/parsed, I like to write it to a temporary file then search through the file, as show in this example.

Also see this thread for more on RS-232 comm handle usage.

Happy coding!
-OptoMary

p.s. This data coming in looks something like this:

$GPGSA,A,1,0.0,0.0,0.0*30
$GPGSV,3,1,12,17,89,000,02,67,000,24,46,000,15,46,000,7E
$GPGSV,3,2,12,30,45,000,31,41,000,09,25,000,05,20,000,77
$GPGGA,164410.971,0000.0000,N,00000.0000,E,0,00,0.0,0.0,M,0000
07
$GPGLL,0000.0000,N,00000.0000,E,164410.971,V
2A

This website was helpful for decoding: http://aprs.gids.nl/nmea/#gga

GPSChartv1_0.zip (3.5 KB)

p.p.s
Somewhat related to this post on “true” – there are several ways of determining if a string starts with “$GPGLL” and setting a Found flag true if so. A couple examples:

    if (0 == FindSubstringInString("$GPGLL", 0, sTemp) ) then // we found the GPG Lat Lon info
      SetVariableTrue(nFound);
    endif

or

    nFound = ( (sTemp[0] == '$') and (sTemp[1] == 'G') and (sTemp[2] == 'P') and (sTemp[3] == 'G') and // they should all start w/$GPG
         (sTemp[4] == 'L') and (sTemp[5] == 'L') );

I have your strategey that grabs the IP address through the modem so I can insert it in an email. Is there a way to do the same thing with GPS data? (the modem has GPS)

I’m not entirely sure what you’re asking for here, but many modems support communication via serial, e.g. an AT command. If your modem has an AT command to give you that GPS data, then it’s probably do-able. Sometimes you get get data from a modem via UDP, too. But modems vary widely! What does the modem’s manual say?

Update, found out that the modem uses TAIP data, which is Trimbals own version of NMEA data.

You can use the same chart, but change the strings that are searched for, its all just strings…

James Davis helped me. We set up the modem to pass GPS data to a COM handle, using an example chart.