English
Language : 

PIC17CXX Datasheet, PDF (9/16 Pages) Microchip Technology – EPROM Memory Programming Specification
EPROM Memory Programming Specification
4.3 CHECKSUM COMPUTATION
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 is the check-
sum.
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.
TABLE 4-4: CHECKSUM COMPUTATION
Device
Code
Protect
Checksum*
Blank
Value
0xC0DE at 0
and max
address
PIC17C42
PIC17C42A
PIC17CR42
PIC17C43
PIC17CR43
PIC17C44
MP mode SUM[0x000:0x7FF] + CFGW & 0x005F + 0xFFA0
MC mode SUM[0x000:0x7FF] + CFGW & 0x005F + 0xFFA0
EMC mode SUM[0x000:0x7FF] + CFGW & 0x005F + 0xFFA0
PMC mode SUM_XNOR8[0x000:0x7FF] + CFGW & 0x005F + 0xFFA0
MP mode SUM[0x000:0x7FF] + CFGW & 0x015F
MC mode SUM[0x000:0x7FF] + CFGW & 0x015F
EMC mode SUM[0x000:0x7FF] + CFGW & 0x015F
PMC mode SUM_XNOR8[0x000:0x7FF] + CFGW & 0x015F
MP mode SUM[0x000:0x7FF] + CFGW & 0x015F
MC mode SUM[0x000:0x7FF] + CFGW & 0x015F
EMC mode SUM[0x000:0x7FF] + CFGW & 0x015F
PMC mode SUM_XNOR8[0x000:0x7FF] + CFGW & 0x015F
MP mode SUM[0x000:0xFFF] + CFGW & 0x015F
MC mode SUM[0x000:0xFFF] + CFGW & 0x015F
EMC mode SUM[0x000:0xFFF] + CFGW & 0x015F
PMC mode SUM_XNOR8[0x000:0xFFF] + CFGW & 0x015F
MP mode SUM[0x000:0xFFF] + CFGW & 0x015F
MC mode SUM[0x000:0xFFF] + CFGW & 0x015F
EMC mode SUM[0x000:0xFFF] + CFGW & 0x015F
PMC mode SUM_XNOR8[0x000:0xFFF] + CFGW & 0x015F
MP mode SUM[0x000:0x1FFF] + CFGW & 0x015F
MC mode SUM[0x000:0x1FFF] + CFGW & 0x015F
EMC mode SUM[0x000:0x1FFF] + CFGW & 0x015F
PMC mode SUM_XNOR8[0x000:0x1FFF] + CFGW & 0x015F
0xF7FF
0xF7EF
0xF7BF
0xF7AF
0xF95F
0xF94F
0xF91F
0xF80F
0xF95F
0xF94F
0xF91F
0xF80F
0xF15F
0xF14F
0xF11F
0xF00F
0xF15F
0xF14F
0xF11F
0xF00F
0xE15F
0xE14F
0xE11F
0xE00F
0x79BD
0x79AD
0x797D
0xBB73
0x7B1D
0x7B0D
0x7ADD
0xBBD3
0x7B1D
0x7B0D
0x7ADD
0xBBD3
0x731D
0x730D
0x72DD
0xB3D3
0x731D
0x730D
0x72DD
0xB3D3
0x631D
0x630D
0x62DD
0xA3D3
Legend: CFGW = Configuration Word
SUM[a:b] = [Sum of locations a to b inclusive]
SUM_XNOR8(a:b) = [Sum of 8-bit wide XNOR copied into upper and lower byte, of locations a to b inclusive]
*Checksum = [Sum of all the individual expressions] MODULO [0xFFFF]
+ = Addition
& = Bitwise AND
© 1996 Microchip Technology Inc.
DS30139I-page 9