User manual

mikroC PRO for dsPIC
MikroElektronika
365
FLASH_Write_Compact
FLASH_Write_Init
Prototype
void FLASH_Write_Compact(unsigned long address, void *data_, unsigned
bytes);
Description Fills a portion of Flash memory using the dsPIC30 RTSP module, in the “compact” manner. In this way,
several blocks of RTSP’s latch can be written in one pass. One latch block contains 4 instructions (8
addresses, 12 bytes). Up to 8 latch blocks can be written in one round, resulting in a total of 8*12 = 96
bytes. 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
- bytes: number of bytes to be written. The amount of bytes to be written must be a multiply of 12,
since this is the size of the RTSP’s write latch(es).
Returns Nothing.
Requires The block to be written to must be erased rst, either from the user code FLASH_Erase32, 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 long ash_address = 0x006000;
char Buffer[] = “supercalifragillisticexpialidotious”;
...
FLASH_Write_Compact(ash_address, Buffer, 36);
Notes The user should take care about the address alignment (see the explanation at the beginning of this
page).
Prototype
void FLASH_Write_Init(unsigned long address, void *data_);
Description Initializes RTSP for write-to-FLASH operation.
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_Erase32, 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
//--- Initializes the Flash to be written, starting from address 0x006100,
the data is located at *pv1
void *pv1;
...
FLASH_Write_Init(0x006100, pv1);
Notes The user should take care about the address alignment (see the explanation at the beginning of this
page).