User manual

368
mikoC PRO for dsPIC
MikroElektronika
FLASH_Write_DoWrite
FLASH_Read4
Prototype
void FLASH_Write_DoWrite();
Description Commits the FLASH write operation.
Parameters None.
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!
This function is used as a part of the Flash write sequence, therefore FLASH_Write_Init and certain
number of FLASH_Write_Loadlatch4 or FLASH_Write_Loadlatch4_Compact function calls must be
made before this one.
This function is to be called once, at the and of the FLASH write sequence.
Example
//--- writes data from an array, in “regular” manner
unsigned int iArr[16] = {‘m’, ‘i’, ‘k’, ‘r’, ‘o’, ‘E’, ‘l’, ‘e’, ‘k’};
void * pv1;
...
pv1 = iArr;
FLASH_Write_Init(0x006100, pv1);
FLASH_Write_Loadlatch4();
FLASH_Write_Loadlatch4();
FLASH_Write_DoWrite();
Notes None.
Prototype
unsigned int* FLASH_Read4(unsigned long address, unsigned int *write_to);
Description Reads one latch row (4 instructions, 8 addresses) in the “regular” mode.
Parameters - address: starting address of the FLASH memory block to be read
- write_to: starting address of RAM buffer for storing read data
Returns Starting address of RAM buffer for storing read data.
Requires Nothing.
Example
//--- reads 8 bytes (4 words) from location 0x006000 and stores it to
*pv1;
unsigned int *pv1;
...
FLASH_Read4(0x006000, pv1);
Notes The user should take care of the address alignment (see the explanation at the beginning of this
page).