Community discussion forum

VB6 NMEA Interpreter Class for Reading GPS

This is a comment thread discussing VB6 NMEA Interpreter Class for Reading GPS
  • 10 years ago

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

  • 3 years ago

    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





  • 3 years ago

    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



  • 3 years ago

    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

  • 3 years ago

    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




















  • 2 years ago
    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..





Post a reply

Enter your message below

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

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