2
Design and Function
16/79 ekr CON 600 net – Process Data Exchange via Profibus
2.3.4 Byte Order
The byte order (Endianness) specifies the order in which the indi-
vidual bytes are transferred. A difference is made between two
types: Big Endian and Little Endian
Example: Storage of a 32-bit integer in 4 bytes
In the example, the integer 16,909,060 is stored as a 32-bit
integer value (hexadecimal: 01020304
h
). The storage takes place
in 4 bytes from an assumed memory address of 10000.
Big Endian stores the figure in the example in the order
01020304=01
h
02
h
03
h
04
h
.
In contrast, Little Endian stores the bytes in the reverse order
04030201=04
h
03
h
02
h
01
h
.
The integer values are transferred in the following format:
Motorola Format
Big-Endian
(e.g. Siemens S7)
Intel Format
Little-Endian
(e.g. PC (Intel))
first the High Byte (MSB) Low Byte (LSB)
then the Low Byte (LSB) High Byte (MSB)
If the user creates the memory fields as data types (e.g. SInteger,
Unsigned, Char, ...), when preparing the PLC data types for the
used communication objects, the byte order does not matter. In
this case the correct byte order is ensured by the control system
(e.g. PLC).
Only if, for example, a word is copied to a bit field, the user must
ensure the correct byte order.
In the descriptions of the communications objects (see chapter
Communication Objects, page 25) the bit numbers for the Little-
Endian and Big-Endian byte order are listed in the tables for the
corresponding objects.