EasyManua.ls Logo

Decagon Devices GS3 - DDI-Serial Checksum

Decagon Devices GS3
12 pages
Print Icon
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
GS3 Integrator Guide R34
For support contact us via email at support@decagon.com
or call us at 1.509.332.5600 between 7AM to 5PM PST
12
DDI-SERIAL CHECKSUM
Here is an example of how to calculate the checksum (crc) in C. In this case, the string passed to the
function would be: "<09>22.0 21.2 1302<0D>w" and the returning value would be the character ‘8’.
char CalculateChecksum(char * Response){
int length, sum = 0, i, crc;
// Finding the length of the response string
length = strlen(Response);
// Adding characters in the response together
for( i = 0; i < length; i++ )
sum += Response[i];
// Converting checksum to a printable character
crc = sum % 64 + 32;
return crc;
}