GAPS - User Guide
G NMEA Checksum Definition
The following definition stands for all protocols based on a NMEA sentence.The information is
stored between the "$" and the "*" characters.
The checksum is the 8-bit exclusive OR (no start or stop bits) of all characters in the
sentence, including "." delimiters, between but not including "$" and the "*" delimiters. The
hexadecimal value of the most significant 4 bits of the result is converted to two ASCII
characters (0- 9, A- F (upper case)) for transmission. The most significant character is
transmitted first.
Code example
char checkSum(String theseChars)
{
char check = 0;
// iterate over the string, XOR each byte with the total sum:
for (int c = 0; c < theseChars.length(); c++)
{
check = char(check ^ theseChars.charAt(c));
}
// return the result
return check;
}
176 MU-GAPS-AN-005-H - November 2019