Intel HEX file format is well documented by KEIL. Here’s how you can calculate the checksum if you only have the Windows 7/8 calculator. Let’s suppose you have the following data record (ending with the checksum F0)
:10001000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0
The checksum calculation works by calculating the sum of all the bytes (pair of hex digits), then calculating the one’s complement of the result, and adding one to that. The latter two operations are equivalent to calculating the two’s complement of the original sum. Thus, using Windows calculator in programmer’s mode, base Hex, the checksum can be calculated as follows
10 + 00 + 10 + 00 + FF + FF + FF + FF + FF + FF + FF + FF + FF + FF + FF + FF + FF + FF + FF + FF = Not + 1 =
OR, simplifying a bit
10 + 10 + ( FF * 10 ) = Not + 1 =
The simplification is based on the fact that there are 16 (or 10 in hexadecimal) FF hexadecimal values and two 10 hexadecimal values. That results in a sum of 1010 in hexadecimal. Calculating a one’s complement of that value and adding 1, gives FFFFFFFFFFFFEFF0. The last byte of that result is the checksum i.e. F0.
Filed under: Windows
