Skip to main content

General

Connect Modbus TCP

Complete reference for the Modbus TCP driver: connection parameters, addressing syntax, and function codes.

Proxus provides a high-performance Modbus TCP driver capable of batch reading and automatic byte swapping.

Supported Protocol Variants

Protocol TypeDescription
Modbus_TcpStandard Modbus TCP
Modbus_Rtu_OverTcpModbus RTU encapsulated over TCP
ModbusAscii_OverTcpModbus ASCII encapsulated over TCP

Connection Parameters

Basic Settings

ParameterTypeRequiredDefaultDescription
HoststringYes-IPv4 address of the PLC or Gateway
PortintNo502Standard Modbus TCP port
PollingIntervalintNo1000Read cycle interval in milliseconds
ConnectTimeoutintNo3000Connection timeout (ms)
ReceiveTimeoutintNo3000Response timeout (ms)

Modbus-Specific Settings

ParameterTypeDefaultDescription
Stationbyte1Unit ID / Slave ID (1-255)
AddressStartWithZerobooltrueUse 0-based addressing
DataFormatenumABCDByte order (ABCD, DCBA, BADC, CDAB)
IsStringReverseboolfalseReverse string byte order
IsCheckMessageIdbooltrueValidate response message ID
Crc16CheckEnablebooltrueEnable CRC16 check (RTU only)
info
Station ID

The Station parameter (Unit ID) is critical when connecting through a Modbus gateway to multiple devices. Each device behind the gateway has a unique Station ID.


Converting Datasheet Addresses

Device datasheets often use different addressing conventions. Here's how to convert them to Proxus format:

Common Datasheet Formats

Datasheet FormatMeaningProxus Format
40001Holding Register 1x=3;0
40100Holding Register 100x=3;99
30001Input Register 1x=4;0
30100Input Register 100x=4;99
00001Coil 1x=1;0
10001Discrete Input 1x=2;0
HR100 / 4x100Holding Register 100x=3;99
IR50 / 3x50Input Register 50x=4;49
warning
1-Based vs 0-Based

Most device datasheets use 1-based addressing (first register = 1), but Modbus protocol uses 0-based addressing (first register = 0).

Always subtract 1 from datasheet addresses:

  • Datasheet says 40100 → Proxus: x=3;99
  • Datasheet says 30050 → Proxus: x=4;49

Conversion Formula

Proxus Address = Datasheet Address - Base - 1

Where Base:
40001 series → Base = 40000 (Holding Registers, FC03)
30001 series → Base = 30000 (Input Registers, FC04)
10001 series → Base = 10000 (Discrete Inputs, FC02)
00001 series → Base = 0 (Coils, FC01)

Real-World Examples

Device/SensorDatasheet SaysProxus AddressData Type
Energy Meter - Voltage30001x=4;0Float
Energy Meter - Current30003x=4;2Float
VFD - Motor Speed40201x=3;200UShort
VFD - Run Command00001x=1;0Bool
Temperature Sensor30101x=4;100Short

Address Syntax

Proxus supports flexible address formats for all Modbus function codes.

Basic Format

The simplest format is just the register address:

{address}

Example: 100 reads register 100 using the default function code (03 for Holding Registers).

Extended Format

For explicit control over station ID and function code:

s={station};x={function};{address}
ComponentDescriptionValues
s=Station/Slave ID1-255
x=Function Code1, 2, 3, 4
w=Write Function Code (optional)5, 6, 15, 16
{address}Register address0-65535

Examples

AddressDescription
100Register 100, default function code
x=3;100Holding Register 100 (FC03)
x=4;100Input Register 100 (FC04)
s=2;100Register 100 on Slave ID 2
s=2;x=3;100Holding Register 100 on Slave ID 2
s=5;x=4;500Input Register 500 on Slave ID 5

Function Codes

CodeAreaAccessDescription
01CoilsRead/WriteDiscrete outputs (bits)
02Discrete InputsRead OnlyDiscrete inputs (bits)
03Holding RegistersRead/Write16-bit registers
04Input RegistersRead Only16-bit input registers

Standard Notation Mapping

If you prefer traditional 5-digit or 6-digit Modbus notation:

NotationFunction CodeProxus Equivalent
000001 - 009999FC01 (Coils)x=1;0
100001 - 109999FC02 (Discrete Inputs)x=2;0
300001 - 309999FC04 (Input Registers)x=4;0
400001 - 409999FC03 (Holding Registers)x=3;0
lightbulb
Recommendation

Use the explicit x={function};{address} format to avoid ambiguity. Different vendors interpret standard notation differently.


Data Types

Multi-register values are automatically reconstructed from consecutive registers.

TypeSizeRegistersDescription
Bool1 bitN/ACoils or Discrete Inputs
Short16 bit1Signed integer
UShort16 bit1Unsigned integer
Int32 bit2Signed 32-bit integer
UInt32 bit2Unsigned 32-bit integer
Long64 bit4Signed 64-bit integer
ULong64 bit4Unsigned 64-bit integer
Float32 bit2IEEE 754 single precision
Double64 bit4IEEE 754 double precision
StringVariableNASCII string (requires length)

Byte Order

Different devices use different byte ordering for multi-register values. Configure the ByteOrder in the Device Profile:

SettingDescriptionExample (0x12345678)
ABCDBig Endian12 34 56 78
DCBALittle Endian78 56 34 12
BADCMid-Big Endian34 12 78 56
CDABMid-Little Endian56 78 12 34
warning
Scrambled Values

If Float or Int32 values appear extremely large, small, or nonsensical, the byte order is likely incorrect. Try different ByteOrder settings.


Performance Features

Batch Reading

The driver automatically groups contiguous addresses into single requests:

  • Registers 100, 101, 102, 103 → Single read request
  • Gaps larger than 2 registers break the batch
  • Dramatically reduces network round-trips

Polling Intervals

Configure different polling rates for different registers. Fast-changing values (e.g., motor speed) can poll at 100ms while slow-changing values (e.g., temperature) poll at 5000ms.


Industry Use Cases

Modbus is our most versatile driver, utilized extensively across multiple industries:

  • Manufacturing: Integrating legacy PLCs, VFDs (Variable Frequency Drives), and simple IO blocks.
  • Energy & Utilities: Real-time data acquisition from power meters, solar inverters, and battery management systems.
  • Mining: Monitoring ventilation fans, pumps, and crushers to optimize extraction efficiency. sub-meters.

Troubleshooting

ErrorCauseSolution
TimeoutDevice not respondingCheck IP, Port, Station ID
Illegal Data AddressRegister doesn't existVerify register number in device manual
Illegal FunctionFunction code not supportedUse correct function code for data area
Gateway Path UnavailableWrong Station IDVerify Unit ID for device behind gateway
TimeoutPollingInterval too shortIncrease PollingInterval or check network latency
Checksum ErrorNoise or wrong settingsVerify Baud Rate, Parity (RTU) or check interference
lightbulb
Need More Help?

For byte order issues, see Byte Ordering Problems. For address conversion, see Modbus Address Syntax.

Official Resources