
onlinecomponents.com
UM EN ILC 1XX
3-12
PHOENIX CONTACT
7805_en_02
3.9
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 compiler 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. Data
transmissions to other controllers can thus be taken into consideration. For example, use
byte arrays with an even number of bytes and/or word arrays in order to avoid data gaps in
your application program.
The following should be taken into consideration when creating the program:
–
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, please observe the memory alignment method of the
controllers used in the application (1-byte, 2-byte or 4-byte alignment).
Program example with
data gaps
The following program example shows how data gaps are filled.
Figure 3-8
Example programming