Sure, I'll share my work. Are we talking about VB, C# or C++ programming?The NMEA 0183 data stream consists of a series of "sentences" delimited by a newline character. Each sentence begins with a six character identifier, the first character of which is always "$". The NMEA 0183 standard defines dozens of sentences, but only a fraction apply directly to GPS devices. The sentences we need include:
- $GPAAM - Waypoint Arrival Alarm
- $GPBOD - Bearing, Origin to Destination
- $GPBWW - Bearing, Waypoint to Waypoint
- $GPGGA - Global Positioning System Fix Data
- $GPGLL - Geographic Position, Latitude/Longitude
- $GPGSA - GPS DOP and Active Satellites
- $GPGST - GPS Pseudorange Noise Statistics
- $GPGSV - GPS Satellites in View
- $GPHDG - Heading, Deviation & Variation
- $GPHDT - Heading, True
- $GPRMB - Recommended Minimum Navigation Information
- $GPRMC - Recommended Minimum Specific GPS/TRANSIT Data
- $GPRTE - Routes
- $GPVTG - Track Made Good and Ground Speed
- $GPWCV - Waypoint Closure Velocity
- $GPWNC - Distance, Waypoint to Waypoint
- $GPWPL - Waypoint Location
- $GPXTE - Cross-Track Error, Measured
- $GPXTR - Cross-Track Error, Dead Reckoning
- $GPZDA - UTC Date/Time and Local Time Zone Offset
- $GPZFO - UTC and Time from Origin Waypoint
- $GPZTG - UTC and Time to Destination Waypoint
For the sake of simplicity, let's just say that we are only interested in position, speed, and course data. Looking at the available NMEA 0183 sentences, we see that the $GPRMC sentence contains all the information we need. The format of the $GPRMC sentence is
$GPRMC,aaaaaa,b,cccc.cc,d,eeeee.ee,f,ggg.g,hhh.h,j jjjjj,kkk.k,l*mm
Where:
- aaaaaa is the time of the fix UTC in hhmmss format
- b is the validity of the fix ("A" = valid, "V" = invalid)
- cccc.cc is the current latitude in ddmm.mm format
- d is the latitude hemisphere ("N" = northern, "S" = southern)
- eeeee.ee is the current longitude in dddmm.mm format
- f is the longitude hemisphere ("E" = eastern, "W" = western)
- ggg.g is the speed in knots
- hhh.h is the true course in degrees
- jjjjjj is the date in DDMMYY format
- kkk.k is the magnetic variation in degrees
- l is the direction of magnetic variation ("E" = east, "W" = west)
- mm is the checksum
Getting the position, speed, and course data in which we are interested now just becomes a matter of reading the $GPRMC sentence into a string, parsing the string to extract the pertinent data, and converting the data into the proper units, simple as that. Its all pretty basic programming with the above info, simply (mostly) IF THEN statements, Its really not as hard as it looks, but my code wont work for the application you have in mind due to the fact I had to make it read from my boards com ports.


Likes:
Thanks:
HaHa: 




Reply With Quote















