I encounter strange STRUCT sizing in CodeSys.
I have a STRUCT with various members, with various sizes. There's no real logic to the order in which the members are located, and I can't change the order. The member are all basic types, and range from BOOL to LREAL and UDINT. The STRUCT is pack_mode 1 due to the fact that it's dumped to disk every few seconds.
When I perform a SIZEOF or VAR_INFO of the struct I get the same number - 324 bytes.
When I count the individual sizes of each of the members I get 332 bytes.
This is strange to me, as I would expect SIZEOF to be the same as the individual members in pack_mode 1, and larger when using other pack_modes.
Could you share example of the struct?
Download CODESYS memory tools from the store and take a look at the memory.
Log in to post a comment.