| Electronic Components Datasheet Search |
|
PIC12F519-E/MS Datasheet(PDF) 24 Page - Microchip Technology |
|
|
|||||||||||||||||||||||||||||
PIC12F519-E/MS Datasheet(HTML) 24 Page - Microchip Technology |
|
24 / 96 page ![]() PIC12F519 DS41319B-page 22 © 2008 Microchip Technology Inc. 5.2.2 WRITING TO FLASH DATA MEMORY Once a cell is erased, new data can be written. Pro- gram execution is suspended during the write cycle. The following sequence must be performed for a single byte write. 1. Load EEADR with the address. 2. Load EEDATA with the data to write. 3. Set the WREN bit to enable write access to the array. 4. Set the WR bit to initiate the erase cycle. If the WR bit is not set in the instruction cycle after the WREN bit is set, the WREN bit will be cleared in hardware. Sample code that follows this procedure is included in Example 3. EXAMPLE 3: WRITING A FLASH DATA MEMORY ROW 5.3 Write Verify Depending on the application, good programming practice may dictate that data written to the Flash data memory be verified. Example 4 is an example of a write verify. EXAMPLE 4: WRITE VERIFY OF DATA EEPROM 5.4 Code Protection Code protection does not prevent the CPU from per- forming read or write operations on the Flash data memory. Refer to the code protection chapter for more information. Note 1: Only a series of BSF commands will work to enable the memory write sequence documented in Example 2. No other sequence of commands will work, no exceptions. 2: For reads, erases and writes to the Flash data memory, there is no need to insert a NOP into the user code as is done on mid-range devices. The instruction imme- diately following the “BSF EECON,WR/RD” will be fetched and executed properly. BANKSEL EEADR MOVLW EE_ADR_WRITE ; LOAD ADDRESS MOVWF EEADR ; MOVLW EE_DATA_TO_WRITE ; LOAD DATA MOVWF EEDATA ; INTO EEDATA REGISTER BSF EECON,WREN ; ENABLE WRITES BSF EECON,WR ; INITITATE ERASE MOVF EEDATA, W ;EEDATA has not changed ;from previous write BSF EECON, RD ;Read the value written XORWF EEDATA, W ; BTFSS STATUS, Z ;Is data the same GOTO WRITE_ERR ;No, handle error ;Yes, continue |
|
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 |