Hi,
so jetzt hab ich noch ein Problem von früher.
.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(); ...
der Compiler frisst das Zwar aber das ist leider nur die halbe Miete.Code:... #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;
das sizeof() ergibt immer entweder die größe eines Elements oder die Pointergröße 2.
egal in welcher Konstellation:
normAmound = sizeof (NormArray);
normAmound = sizeof ( (norm_t*) NormArray);
normAmound = sizeof ( (norm_t**) NormArray);
normAmound = sizeof ( (PGM_P) NormArray);
normAmound = sizeof ( (PGM_P*) NormArray);
normAmound = sizeof ( (PGM_VOID_P) NormArray);
normAmound = sizeof ( (PGM_VOID_P*) NormArray);
gibt es eine Möglichkeit die größe des Arrays zu ermitteln?







Zitieren

Lesezeichen