CXM543 User’s Manual
Doc.# 6001-0015 Rev 1.2
Page 21
±MX is a 5-digit ASCII number representing the X magnetometer count
output. This can range from –32768 to +32767. T represents the system
temperature and is of the form:
TT.T
Where, the T’s are ASCII characters representing the system temperature in
°C. The K is a one byte checksum obtained by adding up all of the ASCII
data characters in the transmission (excluding signs, spaces and decimal
point), and taking the least significant byte of the sum. A space ASCII
character is transmitted after each sensor output.
7.3
Explanation of Checksum Calculation
Calculation of the checksum generally involves summation of the digits of
the transmitted data disregarding decimal points and signs. The method of
summation is different from the binary data and decimal (ASCII) data
formats. For decimal data, the individual digits of the transmitted data are
summed. For example, consider the following vector data transmission in
decimal format (mode = cvd)
þ
EXAMPLE
AX AY AZ MX MY
MZ CS <CR><LF>
+.23456 -.12345 +0.27561 +0.47510 -0.51235 +0.12345 68
The checksum is computed as follows:
2+3+4+5+6+1+2+3+4+5+2+7+5+6+1+4+7+5+1+5+1+2+3+5+1+2+3+4+5
= 104 decimal.
The number 104 (decimal) is 68 in hex; this is the transmitted checksum.
Consider a second example consisting of corrected angle data in decimal
forms (mode = cad)
Roll Pitch Azimuth Total A Total M CS <CR><LF>
100.71 90.05 1.12 1.00000 0.49543 53
The checksum is calculated as follows:
SUNSTAR传感与控制 http://www.sensor-ic.com/ TEL:0755-83376549 FAX:0755-83376182 E-MAIL:[email protected]
SUNSTAR自动化 http://www.sensor-ic.com/ TEL: 0755-83376489 FAX:0755-83376182 E-MAIL:[email protected]