English
Language : 

PIC16F87X_02 Datasheet, PDF (16/22 Pages) Microchip Technology – EEPROM Memory Programming Specification
PIC16F87X
5.0 CHECKSUM COMPUTATION
Checksum is calculated by reading the contents of the
PIC16F87X memory locations and adding up the
opcodes, up to the maximum user addressable loca-
tion, e.g., 0x1FF for the PIC16F87X. Any carry bits
exceeding 16-bits are neglected. Finally, the configura-
tion word (appropriately masked) is added to the
checksum. Checksum computation for each member of
the PIC16F87X devices is shown in Table 5-1.
The checksum is calculated by summing the following:
• The contents of all program memory locations
• The configuration word, appropriately masked
• Masked ID locations (when applicable)
The Least Significant 16 bits of this sum are the
checksum.
The following table describes how to calculate the
checksum for each device. Note that the checksum cal-
culation differs depending on the code protect setting.
Since the program memory locations read out differ-
ently depending on the code protect setting, the table
describes how to manipulate the actual program mem-
ory values to simulate the values that would be read
from a protected device. When calculating a checksum
by reading a device, the entire program memory can
simply be read and summed. The configuration word
and ID locations can always be read.
Note that some older devices have an additional value
added in the checksum. This is to maintain compatibil-
ity with older device programmer checksums.
DS39025F-page 16
 2002 Microchip Technology Inc.