Mikroelektronika MIKROE-724 データシート

ページ / 726
346
mikoBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
FLASH_Write
FLASH_Write_Compact
Prototype
sub  procedure  FLASH_Write(dim  address  as  longint,  dim  byref  data_  as 
word[64])
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 first, 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
dim data_ as word[64] = {“m”, “i”, “k”, “r”, “o”, “E”, “l”, “e”, “k”, “t”, 
“r”, “o”, “n”, “i”, “k”, “a”}
...
FLASH_Write(0x006500, data_)
Notes
The user should take care about the address alignment (see the explanation at the beginning of this 
page).
Prototype
sub procedure FLASH_Write_Compact(dim address as longint, dim byref data_ 
as byte[192])
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 first, 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
dim data_ as string[192]
...
data_ = “supercalifragillisticexpialidotiousABCDEFGHIJKLMNOPRSTUVWXYZ1234”
FLASH_Write_Compact(0x006400, data_)
Notes
The user should take care of the address alignment  (see the explanation  at the beginning  of this 
page).