Hello all
I have a circuit using an ATmega328p TQFN chip. All well and dandy
At the beginning of my routine, it accesses data from the EEPROM.
But, it's not remembering it (or something else is going on). I have tested the read and write and its fine.
At the end of my setup, I recall the data:
//EEPROMreset(); // Perform an EEPROM reset. Uncomment to reset
for (currentPin = 0; currentPin < pinCount; currentPin++) { // Get all the EEPROM values
TXadd[currentPin] = EEPROM.read(currentPin);
}
for (currentPin = 0; currentPin < pinCount; currentPin++) {
TXval[currentPin] = EEPROM.read(currentPin + 10);
}
for (currentPin = 0; currentPin < pinCount; currentPin++) {
TXmode[currentPin] = EEPROM.read(currentPin + 20);
}
for (currentPin = 0; currentPin < pinCount; currentPin++) {
TXdelay[currentPin] = EEPROM.read(currentPin + 30);
}
But this doesn't recall any data.
I have to go and write the data first (I uncomment the EEPROMreset(); in the retrieval code above ) using:
void EEPROMreset() {
for (byte i = 0; i <= 9; i++) { // Store default addresses (Default 1-10)
EEPROM.write(i, (i + 1));
}
for (byte i = 10; i <= 19; i++) { // Store default ON transmitted value (Default 255)
EEPROM.write(i, 255);
}
for (byte i = 20; i <= 29; i++) { // Store default mode (Default momentary)
EEPROM.write(i, 0);
}
for (byte i = 30; i <= 39; i++) { // Store timer delay in seconds (Default 1 second)
EEPROM.write(i, 1);
}
}
I am uploading using a USBasp if that makes any difference.
I am not sure why it's not recalling the data.
If I use the write routine above (void EEPROMreset()) with different variables, they are the ones it recalls. But only if I write them every boot.
Ideas?