Skip to content

Modbus Serial over Ethernet ​

About 5 min read

The Modbus Serial over Ethernet connection type is used to reach Modbus devices on a serial line (RS-485/RS-232) through a serial-to-Ethernet gateway. 2WinScada opens a single TCP connection to the gateway; the devices on the line are distinguished over this connection by their Slave Id values.

  • A channel represents one gateway connection. The gateway address, timeouts and retry settings are defined on the channel.
  • Each slave device on the line is defined as a separate device under the channel.
  • The channel polls the active devices one after another. A device that does not respond delays reading of the other devices for the duration of its timeouts and retries.

Gateway mode

This connection type sends the Modbus RTU frame unchanged over the TCP connection (RTU over TCP). The gateway or serial server must work in transparent (raw / transparent) mode, passing the serial data to TCP without changing it. For gateways that convert Modbus TCP requests to RTU, use the Modbus TCP connection type.

The Connection Type list shows only the protocols that the license allows (see License).

Channel Definition ​

The new channel window opens with the “+” button in the channel list. On the General tab, enter the Name (required, 3–50 characters, cannot start with a digit, unique) and select ModbusOverEth as the Connection Type. The connection type cannot be changed after the channel is saved.

Connection Parameters tab:

FieldDescriptionDefaultRule
IpIPv4 address of the gateway (e.g. 192.168.1.50)255.255.255.255A valid IPv4 address must be entered; DNS names are not accepted. The default value is only a placeholder.
PortModbus TCP port of the gateway5021–65535

Connection Parameters tab of a Modbus Serial over Ethernet channel

The Advanced Parameters tab is the same as on the Modbus Serial channel:

FieldDescriptionDefaultRange
Idle Time To Reinit Device [s]If no successful read is made from any device on the channel for this long, the gateway connection is closed and reopened. 0 turns the feature off.00–86400
Write Timeout [ms]Time to wait for the request to be sent1000Integer
Read Timeout [ms]Time to wait for a response. When it expires, the request counts as failed and the quality of the affected tags becomes Bad.1000Integer
RetriesHow many times a request is repeated after a timeout or communication error. A value of 1 means at most two attempts.1Integer
Wait to retry [ms]Time to wait before a retry250Integer
Slave busy uses retry countIf selected, "busy" (Slave Device Busy) responses from the device also count toward the Retries limit. If not selected, the request is repeated indefinitely as long as busy responses arrive.Selected—

Because the gateway waits for the responses of slow devices on the serial line, choose a Read Timeout [ms] value greater than the sum of the network delay and the response time on the serial line.

If the connection cannot be established, 2WinScada tries to reconnect after 30 seconds at the earliest.

Device Definition ​

The device definition is the same as for Modbus Serial devices. On the General tab, enter the Name (required, 3–100 characters, unique) and set Active.

Parameters tab:

FieldDescriptionDefaultRule
Slave IdModbus address of the device on the serial line1Required; 0–255. Must be different for each device on the line; the Modbus standard uses 1–247.

Settings tab:

FieldDescriptionDefault
Zero BasedIf selected, 1 is subtracted from the register number in the address before it is sent to the device (400001 → protocol address 0).Selected
First Word Low 32 BitIndicates that the first register of 32-bit and 64-bit values is the low word.Selected
First DWord Low 64 BitIndicates that the first two registers of 64-bit values are the low DWord.Selected (if you use 64-bit tags, set it deliberately according to the device documentation)
Block SizeMaximum number of registers (bits for coils/discrete inputs) read in a single read request32

These devices have no Advanced Parameters tab; the timeout and retry settings come from the channel. For details of the settings, see the Modbus Addressing page.

Tag Definition ​

Tags are defined as for Modbus Serial devices (see Modbus Serial – Tag Definition). The Address field is the 6-digit Modbus address (e.g. 400001, 300010, 000005, 400020.7). The address format, data types and word order are described on the Modbus Addressing page.

Troubleshooting ​

SymptomChecks
The connection of all devices on the channel is badCheck the Ip and Port values, network access to the gateway (ping, firewall, VLAN) and the number of TCP connections the gateway accepts at the same time. Reconnection is attempted after 30 seconds at the earliest.
A connection is established but no device respondsCheck that the gateway works in transparent (raw / transparent) mode and that the baud rate, parity and stop bit settings on the serial side match the devices.
A single device does not respondCheck the Slave Id value, the device's connection to the serial line and the Read Timeout [ms] value.
All devices on the line update slowlySet devices that do not respond to inactive; review the Read Timeout [ms] and Retries values.
Values are shifted or meaninglessCheck the Zero Based, First Word Low 32 Bit, First DWord Low 64 Bit and Data Type values (see Modbus Addressing).

2WinScada 2.10