Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Communications > Checksum of NMEA messages


Reply
 
Thread Tools Display Modes
  #1  
Old 02-18-2004, 03:07 PM
elkabubi elkabubi is offline
Newcomer
 
Join Date: Feb 2004
Location: Mexico
Posts: 1
Default Checksum of NMEA messages

This code was made to complete the NMEA code of a GPS.

This is the usual string. it is missing the $ at the begining and the *CC
where cc is the chechsum

GPGGA,204540.999,2041.1120,N,10326.9078,W,1,06,2.1,1501.0,M,,,,0000

This is the complete String.
$GPGGA,204540.999,2041.1120,N,10326.9078,W,1,06,2.1,1501.0,M,,,,0000*2 6

The uses of this code could be any you want, I am just saying what was the purpose of doing it. any questions about the code or the application contact me ok?

I am posting the complete Module. read the example code and you wil easily figure what does the Form1 includes, just two text and one button.

Public Sub CheckSum(ByVal InputString As String, ByRef sumcheck As Byte)
'PURPOSE: Calculate the Or-Exclusive checksum
' Designed for use in the NIME string of GPS
'PARAMETERS: InputString = The string to calculate checksum
' sumcheck = The Oe-Exclusive chexksum in a byte of the string
'
'Example
' Dim sumcheck As Byte
' Dim InputString As String
'
' InputString = Text1.Text
' CheckSum InputString, sumcheck
' Text2.Text = Hex(sumcheck)
'
'********************************************************************* ****

Dim I As Integer
Dim Tamaņo As Integer
Dim bytletters() As Byte

Tamaņo = Len(InputString)
bytletters = StrConv(InputString, vbFromUnicode)
sumcheck = 0
For I = 0 To Tamaņo - 1
sumcheck = sumcheck Xor bytletters(I)
Next I

End Sub
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Purge messages from IMAP server MS Outlook Sitchensis Word, PowerPoint, Outlook, and Other Office Products 1 01-29-2004 11:24 AM
Foxpro Like Checksum Kaveh_1972 General 5 09-29-2003 11:04 PM
Checksum and how to send hex code afwasborstel Communications 0 08-09-2003 02:22 PM
pickfolder for messages fraengi Word, PowerPoint, Outlook, and Other Office Products 1 04-08-2003 05:32 AM
error messages Miles- General 6 10-11-2002 06:50 AM

Advertisement:

Powered by liquidweb