EEPROM Library
This librariry provides access to internal 360 kB non-volatile EEPROM. Data written to EEPROM is saved even if Z-Uno is not powered. Use it to store data in battery and FLiRS devices that should survive battery unplug.
Data written to the EEPROM is saved even if Z-Uno is not powered. Use it to store data that should survive power unplug or sleeping modes.
- put
- get
- read
- update
- write
#include "EEPROM.h"
BYTE some_data[] = {0xaa, 0xbb, 0xcc, 0xdd, 0xee};
BYTE read_data[5];
void setup() {
Serial.begin();
}
void loop() {
byte i;
word res;
dword addr = 0x800;
Serial.println("Reading 128 Bytes one by one from EEPROM...");
for (i = 0; i < 128; i++) {
Serial.print(EEPROM.read(addr + i),HEX);
if (((i % 0x10) == 0) && (i != 0))
Serial.println();
else
Serial.print(' ');
}
Serial.println();
Serial.println("Reading buffer from EEPROM...");
res = EEPROM.get(addr, &read_data, sizeof(read_data));
Serial.print("Read ");
Serial.print(res);
Serial.println(" Bytes");
// write data to a specific address
res = EEPROM.put(addr, &some_data, sizeof(some_data));
delay(5000); // don't write to much in the EEPROM not to kill it
}
#include "EEPROM.h"
BYTE some_data[] = {0xaa, 0xbb, 0xcc, 0xdd, 0xee};
BYTE read_data[5];
void setup() {
Serial.begin();
}
void loop() {
byte i;
word res;
dword addr = 0x0;
Serial.println("Reading 128 Bytes one by one from EEPROM...");
for (i = 0; i < 128; i++) {
Serial.print(EEPROM.read(addr + i),HEX);
if (((i % 0x10) == 0) && (i != 0))
Serial.println();
else
Serial.print(' ');
}
Serial.println();
Serial.println("Reading buffer from EEPROM...");
res = EEPROM.get(addr, &read_data, sizeof(read_data));
Serial.print("Read ");
Serial.print(res);
Serial.println(" Bytes");
// write data to a specific address
res = EEPROM.put(addr, &some_data, sizeof(some_data));
delay(5000); // don't write to much in the EEPROM not to kill it
}
User memory layout:
Start address | End address | Size | Description |
0x0000 | 0x1FFF | 0xE00 | 8 kB | 3584 B | User memory |
0xE00 | 0xE04 | 4 B | Settings of Notification Command Class |
0xE04 | 0xE08 | 4 B | Settings of Wakeup Command Class |
0x2000 | 0xE08 | 0x20FF | 0xE8C | 256 B | 132 B | User configuration parameters |
0x2100 | 0x3FFFF | 248 kB | User memory |
You can also pre-load some data in the EEPROM via USB cable. Check tools section.