von
Draco (Gast)
06.03.2016 09:39
Ich habe da ein Problem mit Progmem... ich habe eine typische 8x8 Matrix
mit Buchstaben, im normalen RAM funktioniert sie tadellos, stelle ich
sie jedoch ins "Progmem" - dann kommt nur noch Müll raus, woran kann das
liegen?! Ich habe schon beide Versionen probiert:
1 extern const char GearBitmap [ 41 ][ 6 ] PROGMEM ;
2 const char GearBitmap [ 41 ][ 6 ] = {
3 { 0x7E , 0x81 , 0x81 , 0x81 , 0x7E , 0x0 }, //0
4 { 0x4 , 0x82 , 0xFF , 0x80 , 0x0 , 0x0 }, //1
5 { 0xE2 , 0x91 , 0x91 , 0x91 , 0x8E , 0x0 }, //2
6 { 0x42 , 0x89 , 0x89 , 0x89 , 0x76 , 0x0 }, //3
7 { 0x1F , 0x10 , 0x10 , 0xFF , 0x10 , 0x0 }, //4
8 { 0x8F , 0x89 , 0x89 , 0x89 , 0x71 , 0x0 }, //5
9 { 0x7E , 0x89 , 0x89 , 0x89 , 0x71 , 0x0 }, //6
10 { 0x1 , 0x1 , 0xF9 , 0x5 , 0x3 , 0x0 }, //7
11 { 0x76 , 0x89 , 0x89 , 0x89 , 0x76 , 0x0 }, //8
12 { 0x8E , 0x91 , 0x91 , 0x91 , 0x7E , 0x0 }, //9
13 { 0x0 , 0x0 , 0x0 , 0x0 , 0x0 , 0x0 }, // blank space
14 { 0x0 , 0x0 , 0x90 , 0x0 , 0x0 , 0x0 }, //:
15 { 0x0 , 0x10 , 0x10 , 0x10 , 0x10 , 0x0 }, // -
16 { 0x0 , 0x0 , 0x80 , 0x0 , 0x0 , 0x0 }, // .
17 { 0xFC , 0x9 , 0x11 , 0x21 , 0xFC , 0x0 }, //Ñ
18 { 0xFE , 0x11 , 0x11 , 0x11 , 0xFE , 0x0 }, //A
19 { 0xFF , 0x89 , 0x89 , 0x89 , 0x76 , 0x0 }, //B
20 { 0x7E , 0x81 , 0x81 , 0x81 , 0x42 , 0x0 }, //C
21 { 0xFF , 0x81 , 0x81 , 0x81 , 0x7E , 0x0 }, //D
22 { 0xFF , 0x89 , 0x89 , 0x89 , 0x81 , 0x0 }, //E
23 { 0xFF , 0x9 , 0x9 , 0x9 , 0x1 , 0x0 }, //F
24 { 0x7E , 0x81 , 0x81 , 0x91 , 0x72 , 0x0 }, //G
25 { 0xFF , 0x8 , 0x8 , 0x8 , 0xFF , 0x0 }, //H
26 { 0x0 , 0x81 , 0xFF , 0x81 , 0x0 , 0x0 }, //I
27 { 0x60 , 0x80 , 0x80 , 0x80 , 0x7F , 0x0 }, //J
28 { 0xFF , 0x18 , 0x24 , 0x42 , 0x81 , 0x0 }, //K
29 { 0xFF , 0x80 , 0x80 , 0x80 , 0x80 , 0x0 }, //L
30 { 0xFF , 0x2 , 0x4 , 0x2 , 0xFF , 0x0 }, //M
31 { 0xFF , 0x2 , 0x4 , 0x8 , 0xFF , 0x0 }, //N
32 { 0x7E , 0x81 , 0x81 , 0x81 , 0x7E , 0x0 }, //O
33 { 0xFF , 0x11 , 0x11 , 0x11 , 0xE , 0x0 }, //P
34 { 0x7E , 0x81 , 0x81 , 0xA1 , 0x7E , 0x80 }, //Q
35 { 0xFF , 0x11 , 0x31 , 0x51 , 0x8E , 0x0 }, //R
36 { 0x46 , 0x89 , 0x89 , 0x89 , 0x72 , 0x0 }, //S
37 { 0x1 , 0x1 , 0xFF , 0x1 , 0x1 , 0x0 }, //T
38 { 0x7F , 0x80 , 0x80 , 0x80 , 0x7F , 0x0 }, //U
39 { 0x3F , 0x40 , 0x80 , 0x40 , 0x3F , 0x0 }, //V
40 { 0x7F , 0x80 , 0x60 , 0x80 , 0x7F , 0x0 }, //W
41 { 0xE3 , 0x14 , 0x8 , 0x14 , 0xE3 , 0x0 }, //X
42 { 0x3 , 0x4 , 0xF8 , 0x4 , 0x3 , 0x0 }, //Y
43 { 0xE1 , 0x91 , 0x89 , 0x85 , 0x83 , 0x0 } //Z
44 };
sowie auch diese Definition ohne Deklaration:
1 const char GearBitmap [ 41 ][ 6 ] PROGMEM = {
2
3 //....
4
5 }
von
Draco (Gast)
06.03.2016 09:46
Ahhhh........ :D
Ich hab noch zu wenig Kaffee heue morgen... ich hab sie natürlich mit
GearBitmap[n][n] abgerufen. Ich muss sie natürlich mit pgm_read_byte
abrufen. Mein Fehler :)
@ Draco (Gast)
>Ich hab noch zu wenig Kaffee heue morgen... ich hab sie natürlich mit
>GearBitmap[n][n] abgerufen. Ich muss sie natürlich mit pgm_read_byte
>abrufen. Mein Fehler :)
Oder man nutzt __flash, dann braucht man das nicht.
https://www.mikrocontroller.net/articles/AVR-GCC-Tutorial#Flash_mit_flash_und_Embedded-C
1 extern const __flash char GearBitmap [ 41 ][ 6 ];
2 const __flash char GearBitmap [ 41 ][ 6 ] = { ... }
3 } ;
4 }
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.