User manual

370
mikoC PRO for dsPIC
MikroElektronika
FLASH_Write
FLASH_Write_Compact
Prototype
void FLASH_Write(unsigned long address, unsigned int *data_);
Description Fills one writeable block of Flash memory (64 instructions, 128 addresses, 192 bytes) in the “regular”
mode. Addresses and data are being mapped 1-on-1. This also means that 3rd byte of each program
location remains unused.
Parameters - address: starting address of the FLASH memory block
- data_: data to be written
Returns Nothing.
Requires The block to be written to must be erased rst, either from the user code (through the RTSP), or during
the programming of MCU. Please note that block size that is to be erased is different from the one that
can be written with this function!
Example
unsigned int iArr[64] = {‘m’, ‘i’, ‘k’, ‘r’, ‘o’, ‘E’, ‘l’, ‘e’, ‘k’, ‘t’,
‘r’, ‘o’, ‘n’, ‘i’, ‘k’, ‘a’};
void * pv1;
...
pv1 = iArr;
FLASH_Write(0x006500, pv1);
Notes The user should take care about the address alignment (see the explanation at the beginning of this
page).
Prototype
void FLASH_Write_Compact(unsigned long address, char *data_);
Description Fills a portion of Flash memory (64 instructions, 128 addresses, 192 bytes) using the dsPIC33 and
PIC24s RTSP (Run Time Self Programming) module, in the “compact” manner. This method uses all
available bytes of the program FLASH memory, including those that are not mapped to address space
(every 3rd byte).
Parameters - address: starting address of the FLASH memory block
- data_: data to be written
Returns Nothing.
Requires The block to be written to must be erased rst, either from the user code (FLASH_Erase), or during
the programming of MCU. Please note that block size that is to be erased is different from the one that
can be written with this function!
Example
char cArr[] =
“supercalifragillisticexpialidotiousABCDEFGHIJKLMNOPRSTUVWXYZ1234”;
void * pv1;
...
pv1 = cArr;
FLASH_Write_Compact(0x006400, pv1);
Notes The user should take care of the address alignment (see the explanation at the beginning of this
page).