I have to make nmea checksum method, that will create checksum for selected string:
the checksum value is derived by the same method of NMEA standard. its calculated by XOR the 8 bits of each character before in the sentence excluding .
The HEX value of the most significant and least significant 4 bits of the result are converted to 2 ASCII characters.
My method:
String c;
int checksum=0;
for (int i = 0; i < command.length(); i++) {
// if it is first value for the checksum
if (i == 0)
{
checksum = (byte)command.charAt(i);
}
else
{
checksum = checksum ^ (byte)command.charAt(i);
}
}
If i enter:
GSC,011412000010789,M2(P3=500)
i get:
checksum: 114
Integer.toHexString(checksum): 72
I get the same result in:
+[
|http://nmeachecksum.eqth.net/]*But in the manual is the result:* +*35*
What do i have to do to get this result? I think it is someting about 4 most al least important bits? How to get them?