8bit in struct is allocated 32bit in memory
Hello,
I am a newbie in struct.
I have a struct declaration below.
typedef struct __serial_data
{
uint8_t frameStart;
uint32_t data;
} serial_data;
serial_data mydata[25];but frameStart is allocated 32bit in memory and this causes trouble when sending through UART.
Initialize the struct.
for(uint16_t cntr = 0; cntr < 25; cntr++)
{
mydata[cntr].frameStart = 0xAA;
mydata[cntr].data = cntr + 1;
}Memory watch
Send to UART
Memory location
Is there any way to send data like:
AA, 01, 00, 00, 00,
AA, 02, 00, 00, 00,
AA, 03, 00, 00, 00,
AA, 04, 00, 00, 00,
......Where:
AA = frame start (8bits)
01 = data (32bits)
Or the only way to do it is to make a separate array and arrange it accordingly and manually?