English
Language : 

PIC16LF145X Datasheet, PDF (28/38 Pages) Microchip Technology – PIC16(L)F145X Memory Programming Specification
PIC16(L)F145X
7.3 Checksum Computation
The checksum is calculated by two different methods
dependent on the setting of the CP Configuration bit.
TABLE 7-1: CONFIGURATION WORD
MASK VALUES
Device
Config. Word 1 Config. Word 2
Mask
Mask
PIC16(L)F1454
PIC16(L)F1455
PIC16(L)F1459
3EFFh
3EFFh
3EFFh
3FF3h
3FF3h
3FF3h
7.3.1
PROGRAM CODE PROTECTION
DISABLED
With the program code protection disabled, the
checksum is computed by reading the contents of the
program memory locations and adding up the program
memory data starting at address 0000h, up to the
maximum user addressable location. Any Carry bit
exceeding 16 bits are ignored. Additionally, the relevant
bits of the Configuration Words are added to the
checksum. All unimplemented Configuration bits are
masked to ‘0’.
EXAMPLE 7-1:
CHECKSUM COMPUTED WITH PROGRAM CODE PROTECTION DISABLED
(CP = 1), PIC16F1459, BLANK DEVICE
PIC16F1459
Sum of Memory addresses 0000h-1FFFh
E000h(1)
Configuration Word 1
3FFFh(2)
Configuration Word 1 mask
3EFFh(3)
Configuration Word 2
3FFFh(4)
Configuration Word 2 mask
3FF3h(5)
Checksum
= E000h + (3FFFh and 3EFFh) + (3FFFh and 3FF3h)(6)
= E000h + 3EFFh + 3FF3h
= 5EF2h
Note 1:
2:
3:
4:
5:
6:
This value is obtained by taking the total number of program memory locations (0x000 to 0x1FFFh
which is E000h) and multiplying it by the blank memory value of 0x3FFF to get the sum of 1FF F800h.
Then, truncate to 16 bits, thus having a final value of F800h.
This value is obtained by making all bits of the Configuration Word 1 a ‘1’, then converting it to hex, thus
having a value of 3FFFh.
This value is obtained by making all used bits of the Configuration Word 1 a ‘1’, then converting it to hex,
thus having a value of 3EFFh.
This value is obtained by making all bits of the Configuration Word 2 a ‘1’, then converting it to hex, thus
having a value of 3FFFh.
This value is obtained by making all used bits of the Configuration Word 2 a ‘1’, then converting it to hex,
thus having a value of 3FF3h.
This value is obtained by ANDing the Configuration Word value with the Configuration Word Mask Value
and adding it to the sum of memory addresses: (3FFFh and 3EFFh) + (3FFFh and 3FF3h) + E000h =
1 34FEh. Then, truncate to 16 bits, thus having a final value of 5EF2h.
DS41620C-page 28
Advance Information
 2011-2012 Microchip Technology Inc.