Keil™, An ARM® Company

Technical Support

C51: ARE CHECKSUM LIBRARY ROUTINES INCLUDED?

QUESTION

Is a checksum routine available with the C51 compiler?

ANSWER

There is no predefined checksum routine included in the C51 library. However, these routines are notoriously easy to implement. For example:

unsigned char calc_checksum (
  unsigned char *start_addr,
  unsigned int len)
{
unsigned char checksum = 0;

for (; len > 0; len--, start_addr++)
  {
  checksum += *start_addr;
  }

return (checksum);
}

is a checksum routine that works with the C51 Compiler.

Last Reviewed: Sunday, May 16, 2004


Did this article provide the answer you needed?
 
Yes
No
Not Sure