Mikroelektronika MIKROE-724 データシート
mikroBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
321
EEPROM_Write
EEPROM_Write_Block
Prototype
sub procedure EEPROM_Write(dim address as longint, dim data_ as word)
Description Writes data to specified
address
.
Parameters -
address
: address of the EEPROM memory location to be written.
-
data
: data to be written.
Returns
Nothing.
Requires
Nothing.
Example
dim wrAddr as longint
eeData as word
...
eeData = 0xAAAA
wrAddr = 0x7FFC30
EEPROM_Write(wrAddr, eeData)
Notes
Specified memory location will be erased before writing starts.
Prototype
sub procedure EEPROM_Write_Block(dim address as longint, dim byref data_ as
word[100])
Description Writes one EEPROM row (16 words block) of data.
Parameters -
Parameters -
address
: starting address of the EEPROM memory block to be written.
-
data
: data block to be written.
Returns
Nothing.
Requires
It is the user’s responsibility to maintain proper address alignment. In this case, address has to be a
multiply of 32, which is the size (in bytes) of one row of MCU’s EEPROM memory.
Example
dim wrAddr as longint
data as string[16]
...
wrAddr = 0x7FFC20
data = “mikroElektronika”
EEPROM_Write_Block(wrAddr, data)
Notes
- Specified memory block will be erased before writing starts.
- This routine is not applicable to the 24F04KA201 and 24F16KA102 family of MCUs, due to the
architecture specifics.
Library Example
This project demonstrates usage of EEPROM library functions for dsPIC30F4013. Each EEPROM (16-bit) location can
be written to individually, or in 16-word blocks, which is somewhat faster than the former. If Writing in blocks, EEPROM
data start address must be a multiply of 16. Please read Help for more details on the library functions!
Copy Code To Clipboard
program Eeprom
dim eeData, i as word
eeAddr as longword
dArr as word[16]