User manual
mikroC PRO for dsPIC
MikroElektronika
345
EEPROM_Write
EEPROM_Write_Block
Prototype
void EEPROM_Write(unsigned long address, unsigned int data_);
Description Writes data to specied address.
Parameters - address: address of the EEPROM memory location to be written.
- data: data to be written.
Returns Nothing.
Requires Nothing.
Example
unsigned int eeWrite = 0xAAAA;
unsigned long wrAddr = 0x7FFC30;
...
EEPROM_Write(wrAddr, eeWrite);
Notes Specied memory location will be erased before writing starts.
Prototype
void EEPROM_Write_Block(unsigned long address, unsigned int *data);
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
unsigned int eeWrite = 0xAAAA;
unsigned long wrAddr = 0x7FFC30;
...
EEPROM_Write(wrAddr, eeWrite);
Notes Specied 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 specics.
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
unsigned int eeData;
unsigned long eeAddr;
unsigned int dArr[16];
void main() {
unsigned i;