ADVANCED: ALIGN

Top  Previous  Next

The ALIGN option can be used in the declaration of a function and a function block. Normally, when you declare a function / function block without the ALIGN option, the VPL translator will pack all the data in the VAR_INPUT , VAR_OUTPUT, and VAR sections on a 1 byte boundary, but when using the ALIGN option, all variables that occupy 2 or 4 bytes will be aligned to the 16-bit architecture of the target platform.

 

The ALIGN option is only used in combination with the MODCALL to ensure that the data layout in the function block corresponds with the layout in the externally called C function.

 

 

FUNCTION_BLOCK ALIGN test;
...
END_FUNCTION_BLOCK;