Attribute pack_mode, L-force | plc designer – Lenze PLC Designer PLC Designer (R3-1) User Manual
Page 1009

L-force | PLC Designer
Programming Reference
DMS 4.1 EN 03/2011 TD29
1007
Attribute Pack_mode
The pragma {attribute 'pack_mode'} defines the mode a data structure is packed while
being allocated. The attribute has to be set on top of a data structure and will
influence the packing of the whole structure.
Syntax:
{attribute 'pack_mode’ := '
The template
following values available:
Value
Assigned pack mode
0
aligned, i.e. there will be no memory gaps
1
1-byte-aligned (identical to aligned)
2
2-byte-aligned, i.e. the maximum size of a memory gap is 1 byte
4
4-byte-aligned, i.e. the maximum size of a memory gap is 3 bytes
8
8-byte-aligned, i.e. the maximum size of a memory gap is 7 bytes
Example:
{attribute 'pack_mode' := '1'}
TYPE myStruct:
STRUCT
Enable: BOOL;
Counter: INT;
MaxSize: BOOL;
MaxSizeReached: BOOL;
END_STRUCT
END_TYPE
A variable of dataytype myStruct will be instantiated aligned: If the address of its
component Enable is 0x0100 for example, then the component Counter will follow on
address 0x0101, MaxSize on 0x0103 and MaxSizeReached on 0x0104. With
'pack_mode'=2 Counter would be found on 0x0102, MaxSize on 0x0104 and
MaxSizeReached on 0x0105.
Note: The attribute may also be applied to POUs. Though, you have to be careful
with its application due to eventually existing internal pointers of the POU.