I am using MPS054 and I found out that the size of a defined structure containing different data types and at least one of them is long type, is related with the order of data types definition. In simulation mode, there is no problem, the size is correct. If I download the same program to the MPS054, the size is different.
The same behaviour is for auto or mapped variables.
myStruct: STRUCT
lwVar: LWORD;
diVar: DINT;
END_STRUCT;
myStruct1: STRUCT
diVar: DINT;
lwVar: LWORD;
END_STRUCT;
VAR
sMyStruct : myStruct;
sMyStruct1 : myStruct1;
END_VAR
SIZEOF(sMyStruct) => 12
SIZEOF(sMyStruct1) => 16
I think this problem is serious, because when I define structures I should take care of the order of data types.