My Visual Basic NMEA - 0183 Parser
Some time ago I bought a bluetooth GPS receiver for my IPAQ Pocket PC, and I wanted to experiment with using a PC serial port to read the data, and interpret the NMEA sentences.

I searched the Internet for VB Source code, but could only find NMEA Parsers written for Java, C++ Linux etc, but nothing useful for VB.

So I decided to write my own. It is a VB Module at the moment, but I'm hoping to create a Dll version pretty soon.

GPS Receivers generally communicate using NMEA -0183 sentences. These are strings of data separated by commas. They have a starting identifier, which indicates what the data is for, data separated by commas, and a terminator & checksum to identify the end.

The data is usually available via a serial port at around 4800,N,8,1. My Module uses the MsComm control to read the data on the required port into a buffer. The software then breaks the data down to 4 Major types defined by VB User Types, and their particular properties. The types and properties are as below:-
For example:-
To show the UTCTime in text1 textbox, use
You can download an example of using the module here. The windows binary PBGPS.exe is in this zip.
If you want to drop me a line click my name below.
Paul Bartlett
Sentence Description
$GPGGA Global positioning system fixed data
$GPGSA GNSS DOP and active satellites
$GPGSV GNSS satellites in view
$GPVTG Course over ground and ground speed

$GPGGA Sentence (Fix data)

Example (signal not acquired): $GPGGA,235947.000,0000.0000,N,00000.0000,E,0,00,0.0,0.0,M,,,,0000*00
Example (signal acquired): $GPGGA,092204.999,4250.5589,S,14718.5084,E,1,04,24.4,19.7,M,,,,0000*1F

Field Example Comments GGA Property
Sentence ID $GPGGA    
UTC Time 092204.999 hhmmss.sss strUttcTime
Latitude 4250.5589 ddmm.mmmm varLatitude
N/S Indicator S N = North, S = South strNSIndicator
Longitude 14718.5084 dddmm.mmmm varLongitude
E/W Indicator E E = East, W = West strEWIndicator
Position Fix 1 0 = Invalid, 1 = Valid SPS, 2 = Valid DGPS, 3 = Valid PPS strPositionfix
Satellites Used 04 Satellites being used (0-12) strSatsUsed
HDOP 24.4 Horizontal dilution of precision strIIDOP
Altitude 19.7 Altitude in meters according to WGS-84 ellipsoid strAltitude
Altitude Units M M = Meters strAltUnits
Geoid Seperation   Geoid seperation in meters according to WGS-84 ellipsoid strGeoid
Seperation Units   M = Meters strSepUnits
DGPS Age   Age of DGPS data in seconds strDgpsAge
DGPS Station ID 0000   strDspgid
Checksum *1F    
Terminator CR/LF    

$GPGSA Sentence (Active satellites)

Example (signal not acquired): $GPGSA,A,1,,,,,,,,,,,,,0.0,0.0,0.0*30
Example (signal acquired): $GPGSA,A,3,01,20,19,13,,,,,,,,,40.4,24.4,32.2*0A

Field Example Comments GSA Property
Sentence ID $GPGSA    
Mode 1 A A = Auto 2D/3D, M = Forced 2D/3D strMode
Fix Type 3 1 = No fix, 2 = 2D, 3 = 3D strFixType
Satellite used 1 01 Satellite used on channel 1 strSat1
Satellite used 2 20 Satellite used on channel 2 strSat2
Satellite used 3 19 Satellite used on channel 3 strSat3
Satellite used 4 13 Satellite used on channel 4 strSat4
Satellite used 5   Satellite used on channel 5 strSat5
Satellite used 6   Satellite used on channel 6 strSat6
Satellite used 7   Satellite used on channel 7 strSat7
Satellite used 8   Satellite used on channel 8 strSat8
Satellite used 9   Satellite used on channel 9 strSat9
Satellite used 10   Satellite used on channel 10 strSat10
Satellite used 11   Satellite used on channel 11 strSat11
Satellite used 12   Satellite used on channel 12 strSat12
PDOP 40.4 Position dilution of precision strPDOP
HDOP 24.4 Horizontal dilution of precision strHDOP
VDOP 32.2 Vertical dilution of precision strVDOP
Checksum *0A    
Terminator CR/LF    

$GPGSV Sentence (Satellites in view)

Example (signal not acquired): $GPGSV,1,1,01,21,00,000,*4B
Example (signal acquired): $GPGSV,3,1,10,20,78,331,45,01,59,235,47,22,41,069,,13,32,252,45*70

Field Example Comments GSV Property
Sentence ID $GPGSV    
Number of messages 3 Number of messages in complete message (1-3) strNoMessages
Sequence number 1 Sequence number of this entry (1-3) strSeq
Satellites in view 10   strSatsInView
Satellite ID 1 20 Range is 1-32 strSatId1
Elevation 1 78 Elevation in degrees (0-90) strElevation1
Azimuth 1 331 Azimuth in degrees (0-359) strAzimuth1
SNR 1 45 Signal to noise ration in dBHZ (0-99) strSNR1
Satellite ID 2 01 Range is 1-32 strSatId2
Elevation 2 59 Elevation in degrees (0-90) strElevation2
Azimuth 2 235 Azimuth in degrees (0-359) strAzimuth2
SNR 2 47 Signal to noise ration in dBHZ (0-99) strSNR2
Satellite ID 3 22 Range is 1-32 strSatId3
Elevation 3 41 Elevation in degrees (0-90) strElevation13
Azimuth 3 069 Azimuth in degrees (0-359) strAzimuth3
SNR 3   Signal to noise ration in dBHZ (0-99) strSNR3
Satellite ID 4 13 Range is 1-32 strSatId4
Elevation 4 32 Elevation in degrees (0-90) strElevation4
Azimuth 4 252 Azimuth in degrees (0-359) strAzimuth4
SNR 4 45 Signal to noise ration in dBHZ (0-99) strSNR4
Checksum *70    
Terminator CR/LF    

$GPVTG Sentence (Course over ground)

Example (signal not acquired): $GPVTG,,T,,M,,N,,K*4E
Example (signal acquired): $GPVTG,89.68,T,,M,0.00,N,0.0,K*5F

Field Example Comments VTG Property
Sentence ID $GPVTG    
Course 89.68 Course in degrees strCourse1
Reference 89.68 T = True heading strReference1
Course   Course in degrees strCourse2
Reference 89.68 M = Magnetic heading strReference2
Speed 0.00 Horizontal speed strSpeed1
Units N N = Knots strSpeedUnit1
Speed 0.00 Horizontal speed strSpeed2
Units K K = KM/h strSpeedUnit2
Checksum *5F    
Terminator CR/LF    
Hit Counter