We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
hi there,
I am using Keil µVision 4 with NXP LPC11U35. I want to load a structure that contains mix type of variables (chars, integers, longs) using a char pointer. How can I set byte alignment so that no data are missed at the alignment?
Thanks in advance.
I have used the following code with no success. I am still missing data at char variables:
effort 1:
typedef __packed struct{ unsigned char soh; unsigned short sender; unsigned short receiver; unsigned char trq; unsigned int command; unsigned short packet; unsigned char stx; unsigned int address; unsigned char data[MAX_DATA_LENGTH]; unsigned int crc; unsigned char etx; unsigned short checksum; unsigned char eoh; }RS485_FRAME;
effort 2:
#pragma push #pragma pack(1) typedef __packed struct{ unsigned char soh; unsigned short sender; unsigned short receiver; unsigned char trq; unsigned int command; unsigned short packet; unsigned char stx; unsigned int address; unsigned char data[MAX_DATA_LENGTH]; unsigned int crc; unsigned char etx; unsigned short checksum; unsigned char eoh; }RS485_FRAME; #pragma pop
sorry my bad...
this works
Thanks