Shop OBEX P1 Docs P2 Docs Learn Events
GPS NMEA Checksum calculation and checking? — Parallax Forums

GPS NMEA Checksum calculation and checking?

Thierry DonzeThierry Donze Posts: 4
edited 2006-03-01 14:00 in BASIC Stamp
The analyse of the quality and validity of NMEA sentence from GPS is mostly base on the checksum, and in one application, I need to verify it.

I have use the Xor (^) calculation of all the characters between $ and *, but excluding them, but I do not find the same value than the one given by the GPS.

Here is the principe of my calculation with a 15 characters NMEA sentence: $HCHDM,274.7,,,,*44

chk············ VAR···· Byte

chk=0

FOR i=1 TO 15
··· READ i, char····················· ' Get next character
··· idx = idx + 1······················ ' Point to next location
····chk=chk ^ char
··· DEBUG char
· NEXT

DEBUG HEX chk,CR

Does any body experience this checking before and can help me?

Thanks and Regards
Thierry

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-02-21 09:39
    Thierry -

    What about the commas, I can't believe they should be included, but to be honest, I've never done GPS checksum before?

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • Thierry DonzeThierry Donze Posts: 4
    edited 2006-02-21 09:43
    Yes the have to be included, only the $ and the * are the delimiter and must not be included in the calculation.

    regards
  • TiboTibo Posts: 81
    edited 2006-02-21 19:59
    Thierry, how do you parse the NMEA sentence ? What STAMP do you use ?
    ++
  • arnoarno Posts: 43
    edited 2006-03-01 14:00
    Didn't you forget the first char of your string ?

    FOR i=1 TO 15

    instead of
    FOR i=0 TO 15 ?
Sign In or Register to comment.