I'm trying to generate a 16 bit checksum from a .hex file I have, I've tried breaking the hexfile into a 1D array of 65476 elements and summing the individual elements but I keep getting the wrong answer. Does anyone have an example of how to create a checksum from a file? I've included what I have that isn't working. I'm ignoreing the first 40K some odd elements because I know they are 0.
Thanks.
The equivalent C++ code is
for( UINT i = 0; i < (dwFileLength >> 1); i++ )
{
if ((pwImage[ i ] & 0xFFFF) != 0)
{
iChecksumPc += pwImage[ i ] & 0xFFFF;
}
}