ARM Technical Support Knowledge Articles

ARE CHECKSUM LIBRARY ROUTINES INCLUDED?

Applies to: C51 C Compiler

Answer

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.

Article last edited on: 2004-05-16 16:54:57

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential