| Electronic Components Datasheet Search |
|
PIC16F15213 Datasheet(PDF) 116 Page - Microchip Technology |
|
|
|||||||||||||||||||||||||||||
PIC16F15213 Datasheet(HTML) 116 Page - Microchip Technology |
|
116 / 439 page ![]() Note: 1. See the NVM Unlock Sequence section. Example 15-4. Writing to Program Flash Memory INTCONbits.GIE = 0; // Disable interrupts // PFM row must be erased before writes can occur NVMCON1bits.NVMREGS = 0; // Point to PFM NVMADR = PFMStartAddress; // Must start at beginning of PFM row NVMCON1bits.FREE = 1; // Specify an erase operation NVMCON1bits.WREN = 1; // Allow erase cycle // Required unlock sequence NVMCON2 = 0x55; NVMCON2 = 0xAA; NVMCON1bits.WR = 1; NVMCON1bits.LWLO = 1; // Load write latches // Write to the data latches for (i = 0; i < PFM_ROW_SIZE; i++) { NVMADR = PFMStartAddress; // Load starting address NVMDAT = PFM_WRITE_DATA; // Load data // Required unlock sequence NVMCON2 = 0x55; NVMCON2 = 0xAA; NVMCON1bits.WR = 1; PFMStartAddress++; // Increment address if(i = (PFM_ROW_SIZE - 1)) // All latches loaded? { NVMCON1bits.LWLO = 0; // Start PFM write } } NVMCON1bits.WREN = 0; // Disable writes INTCONbits.GIE = 1; // Enable interrupts 15.1.2.5 Modifying Flash Program Memory When modifying existing data in a program memory, data within the memory row must be read and saved in a RAM image. Program memory is modified using the following steps: 1. Load the starting address of the row to be modified. 2. Read the existing data from the row into a RAM image. 3. Modify the RAM image to contain the new data to be written into program memory. 4. Load the starting address of the row to be rewritten. 5. Erase the program memory row. 6. Load the write latches with data from the RAM image. 7. Initiate a programming operation. PIC16F15213/14/23/24/43/44 NVM - Nonvolatile Memory Control © 2020-2022 Microchip Technology Inc. and its subsidiaries Data Sheet DS40002195E-page 116 |
|
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 |