Dear friends,
Just to say: My program is running correctly and there is no issue with RAM space or so.
I just do not understand how the compiler can reserve 28 bytes to the variable based on the UNION. I have even tested the situation by filling the memory using the "...asByte[n]". Then I have read the same memory range using "...asWord[n]" and with "...Data...". I know what is stored where, but the compiler assignes double the required memory. The upper 14 bytes are for nothing! How come?
I have tried to "solve" this "non-problem" with #pragma pack and #pragma pack(0..2) to no avail.
Does anyone have an idea. Hardware is mkr WiFi 1010 and mkr SD shield. Hence, nothing special.
Thank you for clarifying this. Mani
typedef struct {
byte bWiFi;
byte bWeb;
byte bRTC;
word wCntr;
byte bSensor;
word wPress;
word wTemp;
word wTerm;
} tsSDData;
typedef union {
tsSDData Data;
byte asByte [sizeof(tsSDData)];
word asWord [sizeof(tsSDData)];
} tuSDData;