Skip to content

Modbus

Modbus is a serial communications protocol implemented on the gateway over a line with a TCP server. A line must be set to one of the Modbus protocols in order to use Modbus. The xPico 600 device acts as a bridge with a network device operating as Modbus master and the devices connected via serial operating as Modbus slaves. There are four Modbus Input CP roles and four Modbus Output CP roles on the xPico 600 that can be read or written from the Modbus TCP Master. You will first need to configure the CPs appropriately for the Modbus CP role. For more information on CP roles, see Configurable Pin Roles. You will need to use a Modbus Master application on your network device to communicate with the gateway and attached Modbus devices.

When the Modbus module is included in firmware, the following configurable pin roles will be found in the Configurable Pin Manager:

Role Name Description
Role Modbus Input 1 Can be read by Modbus TCP.
Role Modbus Input 2 Can be read by Modbus TCP.
Role Modbus Input 3 Can be read by Modbus TCP.
Role Modbus Input 4 Can be read by Modbus TCP.
Role Modbus Output 1 Can be written by Modbus TCP.
Role Modbus Output 2 Can be written by Modbus TCP.
Role Modbus Output 3 Can be written by Modbus TCP.
Role Modbus Output 4 Can be written by Modbus TCP.

The following example uses the modpoll third-party application to read data from the gateway's CPs using Modbus. The gateway responds to address 255:

c:\modpoll-3.6\win>modpoll.exe -t3 -a 255 -r 1 -c 4 -1 -m tcp 172.20.197.120
modpoll 3.6 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright (c) 2002-2018 proconX Pty Ltd
Visit https://www.modbusdriver.com for Modbus libraries and tools.

Protocol configuration: MODBUS/TCP
Slave configuration...: address = 255, start reference = 1, count = 4
Communication.........: 172.20.197.120, port 502, t/o 1.00 s, poll rate 1000 ms
Data type.............: 16-bit register, input register table

-- Polling slave...
[1]: 1
[2]: 0
[3]: 0
[4]: 0

The following example uses the modpoll third-party application to read from an attached slave device at address 1 using Modbus:

c:\modpoll-3.6\win>modpoll.exe -t 0 -a 1 -r 1 -c 4 -1 -m tcp 172.20.197.120
modpoll 3.6 - FieldTalk(tm) Modbus(R) Master Simulator
Copyright (c) 2002-2018 proconX Pty Ltd
Visit https://www.modbusdriver.com for Modbus libraries and tools.

Protocol configuration: MODBUS/TCP
Slave configuration...: address = 1, start reference = 1, count = 4
Communication.........: 172.20.197.120, port 502, t/o 1.00 s, poll rate 1000 ms
Data type.............: discrete output (coil)

-- Polling slave...
[1]: 1
[2]: 0
[3]: 1
[4]: 0

Modbus Status

You can view the current connection status of the Modbus server listening on the TCP port.

To view status:

Modbus Configuration

The following table describes the Web Manager Modbus configuration settings. Settings can be configured for each available Line on the gateway. To use Modbus TCP to Modbus serial bridge, the TCP Server State needs to be enabled in Modbus Configuration and the appropriate Line must be set to the Modbus RTU or Modbus ASCII protocol.

To configure Modbus settings:

  • In Web Manager, go to Modbus, click the appropriate line, and click Configuration.
  • For CLI, see Config Modbus level.
Settings Description
TCP Server State Enables or disables the Modbus TCP server.
Port Sets the TCP server port on which Modbus will accept a connection. Enter 0 for "<None>". The default is 502.
Response Timeout This is the timeout waiting for a response from the slave device in milliseconds. The default is 3000 milliseconds.

Modbus ASCII Protocol

A line protocol can be set to Modbus ASCII. The Modbus ASCII line provides a mode to bridge from a Modbus TCP Master on the network side to Modbus ASCII devices with checksum.

In order to select this operating mode, set the line protocol for the selected interface to "Modbus ASCII" and the threshold to 513 bytes. The TCP Server State must be enabled for a line instance in the Modbus settings before assigning that line instance a Modbus protocol.

To configure Modbus settings:

To configure the Line operating mode:

  • In the Web Manager, go to Line, click a particular line, and click Configuration. Next to Protocol, select "Modbus ASCII.” Next to Threshold, enter "513". Click Submit.
  • For CLI, see Config Line level.
  • For XML, see configgroup Line.

Modbus RTU Protocol

A line protocol can be set to Modbus RTU. The Modbus RTU line provides a mode to bridge from a Modbus TCP Master on the network side to Modbus RTU devices with CRC.

In order to select this operating mode, set the line protocol for the selected interface to "Modbus RTU" and the threshold to 513 bytes. The TCP Server State must be enabled for a line instance in the Modbus settings before assigning that line instance a Modbus protocol.

To configure Modbus settings:

To configure the Line operating mode:

  • In the Web Manager, go to Line, click a particular line, and click Configuration. Next to Protocol, select "Modbus RTU.” Next to Threshold, enter "513". Click Submit.
  • For CLI, see Config Line level.
  • For XML, see configgroup Line.