byte im ram speichern will nicht gehn

Gast #681826
Lesenswert?

tag zusammen

ich wollte mal das abspeichern eines bytes im ram ausprobieren.
dazu habe ich das beispiel aus dem tutorial genommen.

sieht dann bei mir so aus:

#include <inttypes.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>

const uint8_t pgmFooByte PROGMEM = 123;

uint8_t myByte;

myByte = pgm_read_byte(&pgmFooByte);

danach kommt folgender fehler vom compiler:

main.c:18: warning: data definition has no type or storage class
main.c:18: warning: type defaults to ‘int’ in declaration of ‘myByte’
main.c:18: error: conflicting types for ‘myByte’
main.c:16: error: previous declaration of ‘myByte’ was here
main.c:18: error: braced-group within expression allowed only inside a 
function

wobei main.c:16 gleich uint8_t myByte; ist
und main.c:18 gleich myByte = pgm_read_byte(&pgmFooByte);

ich habe schon alles mögliche versucht aber ich bekomm das einfach zum 
laufen.

vielleicht kann mir ja einer weiterhelfen?

danke schonmal

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren