NMEA Checksum calculation

Am rebuildng an exisintg NMEA sentence from a weathersensor into another NMEA format but when doing the checksum at the final end of the NMEA sentence i do get small letters while the NMEA standard describes that every checksum must consist capital letters.
I will show here the difference:
This is a sentence generated by a NMEA simulator which is good:
$WIMTA,22.5,C1E (Capital letter at the end)
This is a sentence generated by Node Red checksum calculator, which gives me a small letter:
1e (small letter at the end)

OpenCPN will accept this sentence but actually is not according official checksum format to NMEA standards.
Is there any option to change this small letter into capital in the following code??

var checksum = 0;

msg.payload = "WIMTA," + msg.payload.value + ",C"

for (var i = 0; i < msg.payload.length; i++) {

checksum = checksum ^ msg.payload.charCodeAt(i);


msg.payload = "$" + msg.payload + "*" + checksum.toString(16);

return msg;

Hope somebody can help me.

toUpperCase() should work.

msg.payload = "$" + msg.payload + "*" + checksum.toString(16).toUpperCase()

That worked :+1:
Many thanks for that.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.