← Strings and Text

Check a Message Checksum

hard

Checks the checksum at the end of a GPS sentence before its data is used.

What it teaches

Many serial protocols end a message with a checksum so the receiver can tell when characters were lost or changed. An NMEA sentence uses the XOR of the codes of every character between '$' and '*', so changing one character changes the result. It is written after the '*' as two hex digits, as a byte was in Byte to Hex Text: 57 is written '39'. Anything before the '$' is noise, the $r$l after the digits from Strip the Terminator is not part of it, and a sentence without '*' is not valid.

Parameters

TagDirectionTypeDefaultDescription
Out_ChecksumOutputDINT0The XOR of the characters between '$' and '*'
Sts_ValidOutputBOOL0The checksum in the sentence matches
Ref_SentenceInOutSTRING—A sentence from a GPS receiver

Required behavior