I am have troubles either saving unsigned long values into progmem or having troubles reading it back.
Can some one tell me why I cannot save 32bit data to program memory and then read it back?
Below is the test program that I am exploring the problem with.
Thanks,
Paul
//const unsigned long paul1[] PROGMEM = {0xAAFF0A, 0xAAFF0B, 0xC, 0xD, 0xE, 0xF};
const uint32_t paul1[] PROGMEM = {0xFF0A, 0xFF0B, 0xC, 0xD, 0xE, 0xF};
int loopnum = 0;
void setup() {
Serial.begin(9600);
while (!Serial); // wait for serial port to connect. Needed for native USB
}
void loop() {
loopnum ++;
Serial.print("Loop: ");
Serial.println(loopnum);
// read back a 2-byte int
for (int k = 0; k < sizeof(paul1)/4; k++) {
//pgm_read_byte_far
//Serial.println(pgm_read_word_near(paul1 + k)); // works for 16 bits
Serial.println(pgm_read_word_far(paul1 + k)); // trying to read 32 bits
}
Serial.println();
Serial.print("Size of paul1: ");
Serial.println(sizeof(paul1));
// for (int k = 0; k < sizeof(paul1); k++) {
// Serial.println(pgm_read_word_near(paul1 + k));
// }
Serial.println();
delay(4000);
}