User manual

mikroPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
319
EEPROM_Write
EEPROM_Write_Block
Prototype
procedure EEPROM_Write(address : longint; data_ : word);
Description Writes data to specied address.
Parameters - address: address of the EEPROM memory location to be written.
- data: data to be written.
Returns Nothing.
Requires Nothing.
Example
var wrAddr : longint;
eeData : word;
...
eeData := 0xAAAA;
wrAddr := 0x7FFC30;
EEPROM_Write(wrAddr, eeData);
Notes Specied memory location will be erased before writing starts.
Prototype
procedure EEPROM_Write_Block(address : longint; var data_ : array[100] of
word);
Description Writes one EEPROM row (16 words block) of data.
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
var wrAddr : longint;
data : string[16];
...
wrAddr := 0x7FFC20;
data := ‘mikroElektronika’;
EEPROM_Write_Block(wrAddr, data);
Notes - Specied 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 specics.
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;
var eeData, i : word;
eeAddr : dword;
dArr : array [16] of word;