Library code snippets

VB6 NMEA Interpreter Class for Reading GPS

This is a Visual Basic 6 version of Jon Person's .NET NMEA Interpreter Class as referenced in
'How to Write a GPS Application'.

GPStest.zip contains the class and a simple project demonstrating implementation.


Comments

  1. 16 Aug 2007 at 21:01
    I have a question regarding GPS bluetooth and programming in visual basic. Where and how do I specify to my VB project the port # of my GPS port? In other words my GPS's port is 41, in VB what do I need to do in order to connect to that port and get the info out of the GPS into strings in VB??

    Anyone's help is greatly appreciated..
    Thanks,
    R..





  2. 16 Jun 2006 at 09:51

    Thank you for the compliment. =o)

    It's interesting that using Time causes an error for you.
    VB6NmeaInterpreter appends 'GMT' to the time string and this is what I see when I run the software, so I can be confident that I am seeing the satellite time.

    I wonder what is making things different for you.

    Certainly your suggested fix would avoid the issue in the test application.

    Changing

    Public Event TimeChanged(ByVal Time As String)

    to

    Public Event TimeChanged(ByVal satTime As String)

    in the VB6NmeaInterpreter class would prevent any future confusion, if using the class in another application.

    regards

    Alex




















  3. 29 May 2006 at 02:45

    Very useful code.
    However there is an a error which prevents displaying "Satellite time"

    The following references the "time" function instead of passing a variable:


    Private Sub gpsTimeChanged(ByVal Time As String)
    LabelTime.Caption = Time
    End Sub

    Accordingly the only time displayed is the system time, not the satellite time.

    Suggested simple change:

    Private Sub gps
    TimeChanged(ByVal CTime As String)
    LabelTime.Caption = CTime
    End Sub

  4. 28 Mar 2006 at 14:35

    The software in which I was using this class started throwing up the odd runtime error.
    To cut a long story short the GPS unit in question was sending truncated sentences and very occasionally the last 2 characters of the truncated sentence happened to equal the checksum resulting in an incomplete sentence being treated as valid.

    Here is the replacement IsValid function to prevent this from happening.

    Private Function IsValid(ByVal sentence As String) As Boolean
    ' Compare the characters after the asterisk to the calculation
    ' Returns True if a sentence's checksum matches the calculated checksum



    If Len(sentence) < 3 Then
    IsValid = False
    Exit Function
    End If


    If Mid$(sentence, Len(sentence) - 2, 1) <> "*" Then
    IsValid = False
    Exit Function
    End If



    If Right$(sentence, 2) = GetChecksum(sentence) Then
    IsValid = True
    Else

    IsValid = False
    End If

    End Function
















    Alex



  5. 20 Mar 2006 at 13:13

    As I delve deeper into NMEA sentences I am improving my understanding.
    The value that is extracted from the GGA string as 'altitude' is in fact the height
    above the WGS84 ellipsoid and not altitude. Surprise [:O]

    Alex





  6. 01 Jan 1999 at 00:00

    This thread is for discussions of VB6 NMEA Interpreter Class for Reading GPS.

Leave a comment

Sign in or Join us (it's free).

Alex Etchells

Want to stay in touch with what's going on? Follow us on twitter!