Hello everyone,
I have to put an uint64_t array into PROGMEM, and then make a copy of it into RAM.
Since there is no pgm_read_uint64 macro, I'm trying to reproduce it's functionality copying the data byte by byte.
Considering the following sketch:
const uint64_t attrib[5] PROGMEM = { 0ULL, 1ULL, 2ULL, 3ULL, 4ULL};
void setup() {
Serial.begin(115200);
for (int i = 0; i < 5; i++)
{
for (int k = 7 ; k >= 0; k--) {
byte b = pgm_read_byte(&attrib[i] + k);
for (int j = 7; j >= 0; j--) { Serial.print(bitRead(b,j)); } ;
Serial.print(" ");
}
Serial.println();
}
}
void loop() { }
It should write this data into progmem:
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000010
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000011
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000100
and then display it in the form above.
Unfortunately I get only the last column proper, the 1-7 columns does contain other bits:
10100000 11011000 01110011 00000100 00000011 00000010 00000001 00000000
00000010 10100000 11011000 01110011 00000100 00000011 00000010 00000001
10110001 00000010 10100000 11011000 01110011 00000100 00000011 00000010
10110001 10110001 00000010 10100000 11011000 01110011 00000100 00000011
10110010 10110001 10110001 00000010 10100000 11011000 01110011 00000100
Does anyone have a clue, where am I wrong ?
Regards,
Ciprian