Hi guys
I am using PIC18F44J10, I need to use a block of flash memory to store some settings. First time ever to use flash in a pic to store data.
Here are the instruction from the datasheet: (P78)
How do I work out the address of my block? As in my case, I am using PIC18F44J10, it has 16KB of flash, I just want to erase the last block (1024 bytes), so I don't accditantly erase amy part of my firmware. Can't find anything in the datasheet.
I am using PIC18F44J10, I need to use a block of flash memory to store some settings. First time ever to use flash in a pic to store data.
Here are the instruction from the datasheet: (P78)
Code:
1. Load Table Pointer register with address of the
block being erased.
2. Set the WREN and FREE bits (EECON1<2,4>)
to enable the erase operation.
3. Disable interrupts.
4. Write 55h to EECON2.
5. Write 0AAh to EECON2.
6. Set the WR bit. This will begin the erase cycle.
7. The CPU will stall for duration of the erase for
TIE (see parameter D133B).
8. Re-enable interrupts.