38
UM-HDRM(G) 4/17
CoMMUNICATIoN ProToCoL (CoNTINUeD)
CHeCksUM CALCULATIoN
unsigned char ComputeChecksum(string text)
{
unsigned char startInx, endInx, crc;
startInx = pos(‘$’, text) + 1; //start at character after ‘$’ in string
endInx = pos(‘*’, text) - 1; //end at character before ‘*’ in string
crc = 0;
for(int n = startInx; n < = endInx; n++)
{
crc = crc ^ text[n];
}
return crc;
}
LENGTh VALuE
DESCRIpTION
1
‘$’
packet Message Start byte
MSGID
Message Identifier; first two characters represents
the manufacturer; last three are Command Code
n
Comma
Delimited
Fields
Field O, Field 1, Field n
1
‘*’
Checksum Delimiter byte
2
Checksum
Checksum is two ASCI characters representing a
hexadecimal byte 00 to FF. value is the exclusive
OR (xOR) of all bytes between, but not including
characters ‘$’ and ‘*’
2
[CR][LF]
Carriage Return Character (OxD) and Line Feed
(OxA) combination terminates the message
TAbLe 13
PACkAGe MessAGe ForMAT
The NMEA (standard protocol) message format is an ASCII string that consists of a message
ID, comma delimited data fields and a checksum field. The message format is described in
Table 13.