ILC 1X1
Program example with
data gaps
76
PHOENIX CONTACT
3.16
Alignment
The alignment of the data elements in the Inline controller memory can result in "data gaps"
when storing data in the memory. The compiler automatically fills these gaps with padding
bytes during the compilation process in order to prevent incorrect processing.
The disadvantage of the "automatic" filling of data gaps becomes apparent when data is
transmitted from the Inline controller to another controller. If this controller does not know the
memory algorithm of the Inline controller, it will interpret the received data incorrectly.
It is therefore useful to program the filling of data gaps in your application program. Alterna-
tively, you can use the PACK and UNPACK function blocks (see online help in PC Worx).
Data transmissions to other controllers can therefore be taken into consideration. For exam-
ple, use byte arrays with an even number of bytes and/or word arrays in order to avoid data
gaps in your application program.
Please observe the following notes for program creation:
–
Create data types in flat structures, i.e., do not nest user-defined data types.
–
Insert padding bytes manually in order to ensure the uniform size and layout of the data
types.
–
When inserting padding bytes, observe the memory alignment method of the control-
lers used in the application (1-byte, 2-byte, or 4-byte alignment).
The following program example shows how data gaps are filled.
Figure 3-34
Example programming
8385_en_02