Flash Memory Library
This library provides routines for accessing microcontroller's (internal) Flash memory.
The program Flash array for the PIC32MX device is built up of a series of rows. A row contains 128 32-bit instruction words or 512 bytes. A group of 8 rows compose a page; which, therefore, contains 8 ՠ512 = 4096 bytes or 1024 instruction words.
A page of Flash is the smallest unit of memory that can be erased at a single time. The program Flash array can be programmed in one of two ways:
- Row programming, with 128 instruction words at a time.
- Word programming, with 1 instruction word at a time.
The CPU stalls (waits) until the programming operation is finished. The CPU will not execute any instruction, or respond to interrupts, during this time. If any interrupts occur during the programming cycle, they remain pending until the cycle completes.
Library Routines
Flash_Write_Word
Prototype |
procedure Flash_Write_Word(address, wdata : dword); |
---|---|
Description |
Writes one 32-bit word in the program Flash memory on the designated address. |
Parameters |
|
Returns |
Nothing. |
Requires |
Nothing. |
Example |
|
Notes |
None. |
Flash_Write_Row
Prototype |
procedure Flash_Write_Row(address: dword; rdata: ^byte); |
---|---|
Description |
Writes one row in the program Flash memory (128 32-bit words or 512 bytes) on the designated address. |
Parameters |
|
Returns |
Nothing. |
Requires |
Nothing. |
Example |
|
Notes |
None. |
Flash_Erase_Page
Prototype |
procedure Flash_Erase_Page(address : dword); |
---|---|
Description |
Erases one page (8 rows, 1024 32-bit word, 4096 bytes) from the program Flash memory. |
Parameters |
|
Returns |
Nothing. |
Requires |
Nothing. |
Example |
|
Notes |
None. |
What do you think about this topic ? Send us feedback!