Also bei mir "E:\WinAVR-20090306rc1\utils\bin\make.exe" all
tuts compilieren ohne warnings und errors
.c Ausschnitt
und die .hCode:#include <avr/io.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <avr/pgmspace.h> #include "main.h" void initio(void); void delay_ms(unsigned int ms); norm_t NormArray[] PROGMEM = { // Faktor Decimal Unit Name {1, 0, { "V"}, {"VOLTAGE 1"}}, // 0 {1, 3, { "mV"}, {"VOLTAGE 2"}}, // 1 {1, 0, { "A"}, {"CURRENT 1"}}, // 2 }; int main( void ) { int i; unsigned char normAmound; normAmound = sizeof (NormArray); initio(); ...
Um das normAmound vom ersten Post zu bekommen, müsstest du aber dein sizeof(NormArray) noch durch die Größe des Structs teilenCode:... #define NORM_UNIT_MAXLEN 4 #define NORM_NAME_MAXLEN 12 typedef char PROGMEM prog_S8; typedef unsigned char PROGMEM prog_U8; typedef struct Norm { prog_U8 factor; prog_U8 decimal; const prog_S8 sNormUnit[NORM_UNIT_MAXLEN]; const prog_S8 sNormName[NORM_NAME_MAXLEN]; }norm_t;
normAmount = sizeof(NormArray)/sizeof(norm_t);
sast
Edit:
Nur mal so als Hinweis. Jörg Wunsch hat mal in einem anderen Forum zu PROGMEM geschrieben:
"It's not required to be global variables, but they ought to
be variables with static storage duration. All global
variables do have that, but it can also be applied to local ones."







Zitieren

Lesezeichen