Forum: Compiler & IDEs mega128 und progmem


von Markus C. (ljmarkus)


Lesenswert?

Hallo.

Ich habe ein Problem mit PROGMEM und MEAG128. Beim Auslesen stimmen die 
Werte leider nicht. Was mache ich falsch?


1
const uint8_t all_off[96] PROGMEM=  {  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2
                                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3
                                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4
                                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5
                                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6
                                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
7
                                
8
const uint8_t all_on[96] PROGMEM  =  {  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
9
                                0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
10
                                0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
11
                                0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
12
                                0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
13
                                0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };

auslesen mache ich so:
1
  else if (bild == 100) { for (unsigned int i=0; i<96; i++) send_bild_buffer[i] = pgm_read_byte_far(all_off[i]);}
2
  else if (bild == 101) { for (unsigned int i=0; i<96; i++) send_bild_buffer[i] = pgm_read_byte_far(all_on[i]);}

Im "send_bild_buffer" sind nicht die gewünschten Daten.
Ich muss mit PROGMEM arbeiten weil ich 100 (Bilder a 96byte) habe.


Danke, Markus

von holger (Gast)


Lesenswert?

...send_bild_buffer[i] = pgm_read_byte_far(&all_off[i]);}

von Markus C. (ljmarkus)


Lesenswert?

main.c:977: warning: cast from pointer to integer of different size

?

Danke, Markus

von Karl H. (kbuchegg)


Lesenswert?


von holger (Gast)


Lesenswert?

>Im "send_bild_buffer" sind nicht die gewünschten Daten.
>Ich muss mit PROGMEM arbeiten weil ich 100 (Bilder a 96byte) habe.

Das sind aber auch nur 9600 Bytes. Da brauchst du doch kein "far".

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.