Does anyone have a check16 utility for doing a 16 bit checksum? If not, does anyone have source for Check8? Thanks,
There are a number of slightly different addition-based 16-bit checksums. The simplest is just to add all 16-bit words, but there are others.
For example, the IP header checksum is the one's complement of the one's complement sum of all 16-bit words. That is, rather than add them all up, you have to add a pair, then add the carry from that addition. Then invert the final result.
Then, there's a 16-bit Fletcher's checksum that's an option in TCP. See RFC 1146.
Can the OP be more specific as to what algorithm you're looking for?
One of the CRC-16s is about as easy to calculate in practice and provides much stronger protection.
I was initially thinking I'd just add up 16 bit words for a stronger version of an 8 bit checksum. Using a similar utility to check8 (like Check16 maybe) write the checksum at the top of the 64 flash and at boot time have the 8051 verify it. I was hoping that if someone already had a something to do this then I wouldn't have to spend the time writing it.