45
ICC
Figure 21: BACnet - Modbus (Analog Objects & Registers) Little Endian
11.5
BACnet - Modbus Binary Element Example
This example also contains two networks that both employ an object value
method for exchanging data, but unlike the previous example, the database
endianness does affect the end-to-end alignment of the data. In this example,
communication is taking place between a BACnet network and a Modbus
network using single-bit data elements. The BACnet side is using binary values 1
through 32, while the Modbus side is using coil status 1 through 32. The byte
ordering of the database is significant because of the manner in which Modbus
coils are mapped in the gateway. Coils (and input statuses) are mapped to
registers, not addresses (refer to the Modbus driver documentation for more
information). Since registers are 16-bit entities, the byte order of the registers
(and by association, the coils), is affected by the endianness configured for the
database. BACnet binary objects, however, are mapped on a byte-wise basis
into the database.
When the database is configured for a little-endian byte order, binary values 1…8
corresponds to coils 1…8, binary values 9…16 corresponds to coils 9…16, and
so on. This can be seen in Figure 22. Notice that the least significant bytes of the
registers that the coils map to are placed in the lower memory addresses in the
database. Because Modbus discretes are mapped to registers in a bit-wise little-
endian fashion, it is recommended that the database be little endian in this
scenario so that bit-wise data will align between networks.