考虑这个片段,用 Arduino IDE 编译:
PROGMEM char charSet[] = { 0x0, 0x8, 0x4, 0xc, 0x2, 0xA , 0x6, 0xE, 0x1, 0x9,0x5, 0xD, 0x3,0xB,0x7,0xF };
char reversed[] = { 0x0, 0x8, 0x4, 0xc, 0x2, 0xA , 0x6, 0xE, 0x1, 0x9,0x5, 0xD, 0x3,0xB,0x7,0xF };
char ff;
for (int i=0; i < 16; i++) {
Serial.print(" ");
Serial.print(reversed[i], HEX);
}
Serial.println(" ");
for (int i=0; i < 16; i++) {
Serial.print(" ");
ff = pgm_read_byte(&charSet[i]);
Serial.print(ff);
}
我希望这两个 for 循环产生相同的输出。但输出是:
0 8 4 C 2 A 6 E 1 9 5 D 3 B 7 F
FFFFFF94 FFFFFFB0 6 FFFFFF80 FFFFFF91 FFFFFFC7 3 62 FFFFFFE3 E FFFFFF94 5E 29 FFFFFF99 23 39
我错过了什么?