| Electronic Components Datasheet Search |
|
PIC16F72 Datasheet(PDF) 10 Page - Microchip Technology |
|
|
|||||||||||||||||||||||||||||
PIC16F72 Datasheet(HTML) 10 Page - Microchip Technology |
|
10 / 14 page ![]() PIC16F72 DS39588A-page 10 Preliminary 2002 Microchip Technology Inc. 4.0 CODE PROTECTION Once code protection is enabled, all program memory locations read all ‘0’s; further programming of program memory is disabled. ID locations and the configuration word may still be read and programmed (1’s to 0’s only). 4.1 Disabling Code Protection The following procedure should be performed before any other programming is attempted. This procedure also turns off code protection (code protect bit = 1); however, all program memory will be erased when this procedure is executed and thus, the security of the code is not compromised. Procedure to disable code protection: a) Issue the ‘Chip Erase’ command. b) Wait for the erase cycle time (tera) to pass. The program memory is erased, then the configura- tion memory is erased. 4.2 Embedding Configuration Word and ID Information in the HEX File 4.3 Checksum Computation The checksum is calculated by reading the contents of the PIC16F72 memory locations and adding up the opcodes, up to the maximum user addressable location (i.e., 0x07FFh for the PIC16F72). Any carry bits exceed- ing 16 bits are neglected. Finally, the configuration word (appropriately masked) is added to the checksum. 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. Table 4-1 describes how to calculate the checksum for the PIC16F72. Note that the checksum calculation dif- fers depending on the code protection setting. Since the program memory locations read out differently depending on the code protection 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 of a non-protected device, the entire program memory can simply be read and summed. The configuration word and ID locations can always be read. TABLE 4-1: CHECKSUM COMPUTATION To allow portability of code, the programmer is required to read the configuration word and ID locations from the HEX file, when loading the HEX file. If configuration word information was not present in the HEX file, then a simple warning message may be issued. Similarly, while saving a HEX file, configuration word and ID information must be included. An option to not include this information may be provided. Microchip Technology Inc. feels strongly that this feature is important for the benefit of the end customer. Device Code Protect Checksum Blank Value 0x05E6 at 0x0000 and max address PIC16F72 OFF SUM[0x000:0x07FF] + CFWD & 0x005F 0xF85F 0x842D ALL CFWD & 0x005F + SUM_ID 0x005E 0x005E Legend: CFWD = Configuration Word SUM[a:b] = [Sum of locations a to b inclusive] SUM_ID = ID locations masked by 0x0F, then concatenated into a 16-bit value with ID0 as the most significant nibble. For example, ID0 = 0x01, ID2 = 0x02, ID3 = 0x03, ID4 = 0x04, then SUM_ID = 0x1234 Checksum = [Sum of all the individual expressions] MODULO [0xFFFF] + = Addition & = Bitwise AND |
|
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |