I'm trying to understand the method behind a GPS NMEA sentence checksum.
Most of what I can find on the net just says this:
Alright, so I'm doing an XOR on all of the ASCII characters between $ and *. But what does that really mean?
First, please confirm for me that "48" represent HEX values, whereas everything between $ and * are actually ASCII character values. Is this correct?
Okay, from here, assuming everything between $ and * is in ASCII, G equals binary 01000111 and P equals binary 01010000.
So:
XOR G,X = binary 00010111
From here, are you supposed to XOR the result of an "XOR G,X with V?
Let's call the XOR of G and X "Dan." The binary value of ASCII "V" is 01110110.
So:
XOR Dan,V = binary 01100001
Do I just keep doing that step over and over again until I reach the ASCII asterisk and then compare the HEX value stored to my calculated checksum?
Does it matter what order I started XORing in -- would I get the same result?
Most of what I can find on the net just says this:
Let's look at this in the context of the following NMEA sentence:"The checksum field consists of a '*' and two hex digits representing an 8 bit exclusive OR of all characters between, but not including, the '$' and '*'."
Rich (BB code):
$GPVTG,054.7,T,034.4,M,005.5,N,010.2,K*48
First, please confirm for me that "48" represent HEX values, whereas everything between $ and * are actually ASCII character values. Is this correct?
Okay, from here, assuming everything between $ and * is in ASCII, G equals binary 01000111 and P equals binary 01010000.
So:
XOR G,X = binary 00010111
From here, are you supposed to XOR the result of an "XOR G,X with V?
Let's call the XOR of G and X "Dan." The binary value of ASCII "V" is 01110110.
So:
XOR Dan,V = binary 01100001
Do I just keep doing that step over and over again until I reach the ASCII asterisk and then compare the HEX value stored to my calculated checksum?
Does it matter what order I started XORing in -- would I get the same result?