How to calculate NMEA checksum.

Discussion in 'General GPS Discussion' started by maheshjo21, Oct 15, 2018.

  1. maheshjo21

    maheshjo21

    Joined:
    Oct 15, 2018
    Messages:
    4
    Likes Received:
    0
    NMEA sentence/string is :
    $GPRMC,062745.044,A,1830.2470,N,07350.5297,E,1.07,44.40,101018,,,A*

    How to calculate checksum of above string. I need formula for this checksum calculation.

    Thanks in advance.
     
    maheshjo21, Oct 15, 2018
    #1
  2. maheshjo21

    Nuvi-Nebie Moderator

    Joined:
    Aug 16, 2015
    Messages:
    2,337
    Likes Received:
    200
    Location:
    UK
    Nuvi-Nebie, Oct 15, 2018
    #2
  3. maheshjo21

    maheshjo21

    Joined:
    Oct 15, 2018
    Messages:
    4
    Likes Received:
    0
    Thanks.. but I need formula for this checksum calculation.
     
    maheshjo21, Oct 16, 2018
    #3
  4. maheshjo21

    Nuvi-Nebie Moderator

    Joined:
    Aug 16, 2015
    Messages:
    2,337
    Likes Received:
    200
    Location:
    UK
    Google Search
     
    Nuvi-Nebie, Oct 16, 2018
    #4
  5. maheshjo21

    maheshjo21

    Joined:
    Oct 15, 2018
    Messages:
    4
    Likes Received:
    0
    Thanks Nuvi Neble
     
    maheshjo21, Oct 22, 2018
    #5
  6. maheshjo21

    maheshjo21

    Joined:
    Oct 15, 2018
    Messages:
    4
    Likes Received:
    0
    Writen macro for NMEA checksum Calculation.

    Shared Working Macro code:

    Private Function GetChecksum(ByRef sInString As String) As String
    Dim lCurrent&, lLast&
    On Error Resume Next
    '-- We don't use the $ in the checksum
    If Mid$(sInString, 1, 1) = "$" Then
    sInString = Mid$(sInString, 2)
    End If
    '-- Get the ASC of the first Char
    lLast& = Asc(Mid$(sInString, 1, 1))
    '-- Use a loop to Xor through the string
    For lCurrent& = 2 To Len(sInString)
    lLast& = lLast& Xor Asc(Mid$(sInString, lCurrent&, 1))
    Next
    '-- Pass the data back as a string
    GetChecksum = CStr(Hex(lLast&))
    End Function

    This code is working ... use as it is.

     
    maheshjo21, Oct 22, 2018
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
There are no similar threads yet.
Loading...