EasyManua.ls Logo

Microchip Technology dsPIC30F - Page 111

Microchip Technology dsPIC30F
738 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
© 2004 Microchip Technology Inc. DS70052C-page 5-15
Section 5. Flash and EEPROM Programming
Flash and EEPROM
Programming
5
5.5.1 EEPROM Single Word Programming Algorithm
1. Erase one EEPROM word.
Setup NVMCON register to erase one EEPROM word.
Write address of word to be erased into TBLPAG, NVMADR registers.
Clear NVMIF status bit and enable NVM interrupt (optional).
Write the key sequence to NVMKEY.
Set the WR bit. This will begin erase cycle.
Either poll the WR bit or wait for the NVM interrupt.
2. Write data word into data EEPROM write latch.
3. Program the data word into the EEPROM.
Setup the NVMCON register to program one EEPROM word.
Clear NVMIF status bit and enable NVM interrupt (optional).
Write the key sequence to NVMKEY.
Set the WR bit. This will begin the program cycle.
Either poll the WR bit or wait for the NVM interrupt.
5.5.2 EEPROM Row Programming Algorithm
If multiple words need to be programmed into the EEPROM, it is quicker to erase and program
16 words (1 row) at a time. The process to program 16 words of EEPROM is:
1. Read one row of data EEPROM (16 words) and store into data RAM as a data “image”.
The section of EEPROM to be modified must fall on an even 16-word address boundary.
2. Update the data image with the new data.
3. Erase the EEPROM row.
Setup the NVMCON register to erase one row of EEPROM.
Clear NVMIF status bit and enable NVM interrupt (optional).
Write the key sequence to NVMKEY.
Set the WR bit. This will begin the erase cycle.
Either poll the WR bit or wait for the NVM interrupt.
4. Write the 16 data words into the data EEPROM write latches.
5. Program a row into data EEPROM.
Setup the NVMCON register to program one row of EEPROM.
Clear NVMIF status bit and enable NVM interrupt (optional).
Write the key sequence to NVMKEY.
Set the WR bit. This will begin the program cycle.
Either poll the WR bit or wait for the NVM interrupt.

Table of Contents

Other manuals for Microchip Technology dsPIC30F