| Electronic Components Datasheet Search |
|
PIC16F15213 Datasheet(PDF) 117 Page - Microchip Technology |
|
|
|||||||||||||||||||||||||||||
PIC16F15213 Datasheet(HTML) 117 Page - Microchip Technology |
|
117 / 420 page ![]() Note: 1. See Figure 15-2. Example 15-4. Writing to Program Flash Memory ; This write routine assumes the following: ; 1. 64 bytes of data are loaded, starting at the address in DATA_ADDR ; 2. Each word of data is made up of two adjacent bytes in DATA_ADDR, ; stored in little endian format ; 3. A valid starting address (LSb’s = 00000) is loaded in ADDRH:ADDRL ; 4. ADDRH and ADDRL are located in common RAM (locations 0x70 - 0x7F) ; 5. NVM interrupts are not taken into account BANKSEL NVMADRH MOVF ADDRH,W MOVWF NVMADRH ; Load initial address MOVF ADDRL,W MOVWF NVMADRL MOVLW LOW DATA_ADDR ; Load initial data address MOVWF FSR0L MOVLW HIGH DATA_ADDR MOVWF FSR0H BCF NVMCON1,NVMREGS ; Set Program Flash Memory as write location BSF NVMCON1,WREN ; Enable writes BSF NVMCON1,LWLO ; Load only write latches LOOP MOVIW FSR0++ MOVWF NVMDATL ; Load first data byte MOVIW FSR0++ MOVWF NVMDATH ; Load second data byte MOVF NVMADRL,W XORLW 0x1F ; Check if lower bits of address are 00000 ANDLW 0x1F ; and if on last of 32 addresses BTFSC STATUS,Z ; Last of 32 words? GOTO START_WRITE ; If so, go write latches into memory CALL UNLOCK_SEQ ; If not, go load latch INCF NVMADRL,F ; Increment address GOTO LOOP START_WRITE BCF NVMCON1,LWLO ; Latch writes complete, now write memory CALL UNLOCK_SEQ ; Perform required unlock sequence BCF NVMCON1,WREN ; Disable writes UNLOCK_SEQ MOVLW 55h BCF INTCON,GIE ; Disable interrupts MOVWF NVMCON2 ; Begin unlock sequence MOVLW AAh MOVWF NVMCON2 BSF NVMCON1,WR BSF INTCON,GIE ; Unlock sequence complete, re-enable interrupts return 15.3.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 Microchip Technology Inc. Preliminary Datasheet DS40002195A-page 117 |
|
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 |