This section covers the basic settings for Modbus TCP communication, including connection parameters, enabling and disabling the app instance, and adjusting the byte, word and bit order to match device-specific data formats.
Correct configuration of these settings is essential for reliable data exchange between Modbus and KNX.
รbersicht
Note โ Communication with the Modbus Gateway
If the network connection is interrupted, for example due to a restart of the Modbus TCP Client, a power failure or a similar event, the MODBUS TCP Connect Smart Home App will normally reconnect automatically.
However, we recommend checking the connection and restarting the corresponding Smart Home App instance if necessary.
Enable Address
The enable address allows you to enable or disable this Smart Home App instance using a KNX telegram.
If no enable address is configured, the instance remains active until it is manually stopped via the web interface.
Modbus TCP Host
Enter the IP address of the Modbus TCP device or gateway to which the app should connect.
Modbus TCP Port
Enter the TCP port number of the Modbus TCP device or gateway.
The default port for Modbus TCP communication is 502.
Modbus TCP Unit ID
Enter the Unit ID (also known as the Slave ID) of the Modbus device you wish to communicate with.
The Unit ID is particularly relevant when using a Modbus TCP gateway, as it is used to address the connected Modbus device.
Refer to the device documentation or configuration to determine the required Unit ID.
Swap Byte Order
A Modbus register consists of 16 bits and therefore contains two bytes. According to the Modbus specification, the most significant byte (high byte) is transmitted first, followed by the least significant byte (low byte). This byte order is known as big-endian.
However, some manufacturers use alternative data formats in which the two bytes are arranged in reverse order.
Enable this option to reverse the order of the two bytes within each 16-bit register.
-
Disabled: High Byte First (big-endian)
-
Enabled: Low Byte First (little-endian)
This setting affects both 16-bit data types and data types spanning multiple Modbus registers. The order of the registers themselves remains unchanged.
Swap Word Order
As a single Modbus register contains only 16 bits, larger data types, such as 32-bit integers or 32-bit floating-point values (float), are stored across two consecutive Modbus registers. Each register represents a 16-bit word.
The Modbus specification does not define the word order for data types spanning multiple registers. Consequently, the word order may vary depending on the manufacturer and device.
Enable this option if the least significant word is stored before the most significant word.
-
Disabled: High Word First โ most significant word first
-
Enabled: Low Word First โ least significant word first
This setting is particularly relevant when processing 32-bit data types. The byte order within each individual word remains unchanged.
Byte order and word order can be swapped independently. Refer to the device manufacturer's Modbus documentation to determine the required combination of settings.
Swap Bit Order
Enable this option to reverse the bit order when processing Modbus data.
This setting ensures compatibility with device-specific bit arrangements.
Notes on Data Ordering
Many energy management devices, such as inverters, smart meters and battery energy storage systems, support the SunSpec Modbus standard.
SunSpec specifies big-endian byte and word ordering for numerical values. When using a SunSpec-compliant register map, byte and word order settings generally do not need to be adjusted.
Some manufacturers allow you to select different Modbus register maps or data formats in the device configuration.
Refer to the manufacturer's Modbus documentation to determine the required byte, word and bit order settings.
Incorrect data order settings may result in measurement values being misinterpreted or incorrect values being written to the Modbus device.Beispiel zur Byte- und Wort-Reihenfolge
Byte and Word Order Example
The following example illustrates how the different settings affect a 32-bit value (0x12345678) stored across two consecutive Modbus registers.
|
Setting |
Register n
|
Register n
|
Register n+1
|
Register n+1
|
|---|---|---|---|---|
|
Original order |
๐ฆ 12 |
๐ฆ 34 |
๐ฉ 56 |
๐ฉ 78 |
|
Swap Byte Order |
๐ฆ 34 |
๐ฆ 12 |
๐ฉ 78 |
๐ฉ 56 |
|
Swap Word Order |
๐ฉ 56 |
๐ฉ 78 |
๐ฆ 12 |
๐ฆ 34 |
|
Swap Byte and Word Order |
๐ฉ 78 |
๐ฉ 56 |
๐ฆ 34 |
๐ฆ 12 |
Legend:
-
๐ฆ High Word: Most significant 16-bit word (0x1234)
-
๐ฉ Low Word: Least significant 16-bit word (0x5678)
Swapping the byte order reverses the two bytes within each register, whereas swapping the word order reverses the position of the two 16-bit words as a whole. Both settings can be enabled independently.
///