Skip to main content

Modbus TCP

The Modbus TCP protocol in InDataX enables communication with a wide variety of industrial devices over Ethernet networks. This driver is versatile, supporting both standard TCP/IP and TCP over RTU (encapsulated) connections.

Connection Parameters

To configure the Modbus TCP communication channel, define the following fields:

  • Name: Unique identifier for the protocol.
  • Connection Type: Select between TCP/IP (standard) or TCP over RTU (if the Modbus RTU device is behind a gateway).
  • IP Address: The IP address of the slave device or gateway.
  • Port: The listening port (usually 502).
  • Modbus Slave ID: The device identifier (Unit ID), usually 1.

Variable Configuration

Data access in Modbus is performed through registers. InDataX allows for simple mapping of these registers:

  • Name: Name of the variable in InDataX.
  • Type: Data type for conversion (Real, Integer, Boolean, etc.).
  • Record Value: Inclusion in the Thing's historical logs.
  • Modbus Address: Numerical address of the starting register.
  • Length: Number of registers that make up the variable (e.g., 2 registers for a 32-bit value).
  • Register Type:
    • Coil: Output bits that allow reading and writing (e.g., activating a relay).
    • Discrete Input: Read-only input bits (e.g., status of a digital sensor).
    • Holding Register: 16-bit registers that allow reading and writing. This is the most common type for setpoints and configurations.
    • Input Register: 16-bit read-only input registers for process data (e.g., analog sensor values).
  • Signed: Indicates whether the value should be interpreted as a signed number (positive/negative).
Register vs Address

Make sure to check whether your device's manual uses 0-based or 1-based addressing, as this is often the most common cause of reading errors.

Configuration Example

Below are common examples of how to map industrial data using Modbus TCP:

VariableTypeAddressLengthRegister TypeNotes
oven_temperatureReal1002Holding RegisterA 32-bit value occupies two 16-bit registers.
motor_statusBoolean101CoilReading/Writing an individual output bit.
flow_rate_m3hInteger2001Input Register16-bit read-only value from a sensor.
digital_inputBoolean51Discrete InputStatus of a read-only physical contact.
Byte Order (Endianness)

In Modbus TCP, when reading 32-bit values (like Reals), the order of registers or bytes can vary depending on the manufacturer (Little-Endian vs. Big-Endian). If you get incoherent values, you may need to adjust the reading order in the system logic.