Skip to main content

Modbus Server

This target exposes variables from a forwarding group to an external Modbus master through Modbus TCP or Modbus RTU. The current Modbus type list has no ASCII option.

Configure the forwarding group and target through Data Forwarding. This page covers Modbus server properties, address mapping, client permissions, and protocol debug.

Open the plugin​

Open Development Configuration → Data Forwarding and:

  1. Save the forwarding-group variable range.
  2. Add a target, choose Modbus Server, and fill in its basic target information.
  3. Open Target properties, choose the Modbus type and channel, then configure protocol, permissions, serial, DTU, or TLS settings.
  4. Save the target and configure a required Slave variable address for each exposed variable.
  5. Enable the target and verify with an external Modbus master or the debug page.

Basic target information​

SettingDefaultConfiguration
Group-Select a saved forwarding group.
Target name-Required and unique within the group.
EnableEnabledDisable to stop listening.
Log levelInfoTemporarily use Debug for protocol diagnostics.
Start timeout60 secondsValid range is 1 to 3600 seconds.

Target properties​

Protocol​

SettingDefaultConfiguration
Modbus typeModbusTcpCurrent choices are ModbusTcp (MBAP) and ModbusRtu (binary RTU + CRC16). TCP normally uses TcpService; RTU normally uses SerialPort.
Default station1Used when an address has no S= prefix.
Multiple-station modeEnabledAllows multiple stations in one target.
Channel typeTcpServiceCurrent choices are TcpService, TcpClient, UdpSession, and SerialPort; no Other transport.

Data format​

SettingDefaultConfiguration
Data formatABCDSelect ABCD, BADC, CDAB, or DCBA to match the external master.
Reverse string bytesDisabledReverse string bytes by word only when required by the external layout.

Permissions​

SettingDefaultConfiguration
Allow RPC writeEnabledTarget-level write switch. Disable for read-only monitoring.
Client permission listEmptyApplies to TCP server mode. Empty does not restrict IPs; a non-empty list admits only matching AllowedClientIp entries, with AllowWrite also required for writes. Serial, UDP, and active TCP do not use this incoming-client IP list.

Runtime​

SettingDefaultConfiguration
Write to memory immediatelyEnabledControls immediate protocol-memory update; turning it off does not disable the real variable RPC write.
Send delay0 msDelay before a reply frame when required by the master.
Connection timeout3000 msConnection-operation timeout; minimum 100 ms.
Heartbeat contentEmptyOptional application heartbeat in active TCP mode with a non-empty DTU ID.
Heartbeat is HexDisabledTreats heartbeat content as hexadecimal when enabled.
Heartbeat interval60000 msActive TCP heartbeat interval; zero disables periodic sends. It does not enable periodic heartbeats on a TCP server.

Connection​

SettingDefaultConfiguration
Remote address127.0.0.1:502Used only when the selected channel requires a remote endpoint.
Local bind address0.0.0.0:502TCP service listen address. Restrict it to a required interface in production.
Serial portCOM1Used for serial channels.
DTU IDEmptyRegistration content sent after an active TCP connection is established.
DTU ID is HexDisabledEncodes that outgoing registration as Hex bytes instead of UTF-8 text.
DTU service typeDefaultSelect DDP for a TCP server or UDP endpoint that requires DDP framing; keep Default for ordinary Modbus.

TLS​

SettingDefaultConfiguration
Enable SSLDisabledEnables TLS for TCP client or server channels. UDP and serial channels do not use these SSL settings.
SSL target hostEmptyActive TCP client's expected remote server name, matched against the server certificate.
SSL client certificateEmptyClient certificate for mutual TLS.
SSL server certificateEmptyCertificate presented by a server channel.
SSL CA certificateEmptyCA used to validate peer certificates.
Allow untrusted certificateEnabledIn TCP server mode, disabling this requires and validates the external master's client certificate; configure CA trust and give the master a valid certificate with its private key. The master must separately validate the gateway server. In active TCP mode this controls validation of the remote server; keep strict validation in production.
SSL protocolNoneKeep the system default unless the peer requires a specific TLS version.
Check certificate revocationDisabledEnable according to the security policy.

Serial port​

SettingDefaultConfiguration
Baud rate9600Must match the external master and serial device.
Data bits8Must match the external master.
ParityNoneMust match the external master.
Stop bitsOneMust match the external master.
DTR / RTSEnabled / EnabledHardware flow-control switches.
Async streamEnabledEnables asynchronous serial I/O.
HandshakeDefaultSerial handshake mode.
Input / output buffer4096 / 2048 bytesIncrease only for long or continuous frames.

Capacity and reliability​

SettingDefaultConfiguration
Maximum concurrency1Shared channel property; passive service initialization uses a single-request limit. A larger form value does not establish equal network parallelism.
Maximum connections10000Maximum client connections.
Frame cache time500 msFrame assembly cache window; minimum 100 ms.
Client cleanup time120000 msIdle-client cleanup; zero disables it, otherwise use at least 10000 ms. Actual expiry depends on the cleanup schedule.

Target variable properties​

SettingDescription
Slave variable addressRequired. Modbus address exposed to the external master.
Data typeDefault Int16. Data type used for this target mapping.
Allow RPC writeRequires target, target-variable, and source-variable write permission. In TCP server mode, a configured client list must also admit the client with AllowWrite.

The variable must already be inside the forwarding group's range. Adding a target variable property does not add a member to the group.

Address rules​

AddressData areaCommon read function
00001CoilsFC1
10001Discrete inputsFC2
30001Input registersFC4
40001Holding registersFC3

Addresses use one-based notation. S=2;40001 exposes holding register 40001 at station 2; F=3;0 explicitly uses FC3 with zero-based offset 0; 40001.3 exposes bit 3 of the register.

Within one target, station, function, and start-address combinations must not overlap. Match the data type and register size to the external master's point list.

Contiguous writes and complete values​

For a master's contiguous write, the gateway checks every variable intersecting the requested range. Each must be fully covered and pass target, client, mapped-variable, and source-variable write permissions before device writes begin.

A Float mapped at 40001 occupies two registers. Writing only 40001 or 40002 partially covers the value and is rejected. Both registers are required. A request spanning multiple mapped variables must fully cover each one. Strings, arrays, and multi-register integers use their actual occupied length.

First write and read back complete values. Then test partial coverage and a range containing a nonwritable variable; rejected requests should cause no device writes for that batch. Once range and permission checks pass, verify each device's execution result separately. Writes across devices are not a single atomic transaction.

Target debug​

Open Development Configuration → Data Forwarding, select the forwarding group and target, and open Debug.

Read and write​

Modbus Server read and write panel

Read a mapped address first. Before writing, confirm target, channel, client, and variable write permissions.

Forwarding pipeline​

Modbus Server forwarding pipeline

Use the pipeline view to confirm how a group variable becomes an exposed Modbus value.

Protocol service​

Modbus Server protocol service

Check the listening endpoint, connected clients, and protocol-service state.

Functions​

FunctionPurpose
Read and writeRead a confirmed point and write only to an approved test point.
Forwarding pipelineInspect group membership and variables entering the service mapping.
Protocol serviceInspect listening endpoints, connected clients, and service state.

Protocol memory and field verification​

Local debug reads/writes inspect service memory. They do not establish an external master's network access or a real field write. Check the external address mapping independently of the collection address: holding 40001 maps to offset 0, 40011 to offset 10.

For a first test, map one working Int16 variable to 40001 at station 1, format ABCD. Use an independent master with unit ID 1, FC3, offset 0, and count 1. Move the service address to 40011 and read offset 10; the collection address stays unchanged. Input-register mapping 30001 requires FC4. For a permitted holding-register write, check the protocol result, actual source readback, and a later external read, then disable each write switch separately and confirm reads continue while writes fail.

Byte writes can leave the neighboring register byte unchanged. Decimal occupies sixteen bytes/eight registers; Object has no universal register mapping. For UInt32 2345, layouts are ABCD 00 00 09 29, BADC 00 00 29 09, CDAB 09 29 00 00, and DCBA 29 09 00 00. Match the remote master's type and order, then verify two values and real source feedback.

An active TCP connection still serves the Modbus slave role. RTU over TCP, UDP, and DDP add different transport/framing requirements. Passive concurrency cannot be inferred solely from the form. Idle cleanup 0 disables expiry; a nonzero value must be at least 10000 ms. Framing and TLS handshake budgets apply to different stages.

Verify the target​

  1. Start the target and confirm the server is listening.
  2. Connect an external Modbus master.
  3. Read one mapped variable in each configured data area.
  4. If writing is enabled, write one safe value and confirm the gateway variable changes as expected.

Troubleshooting​

SymptomCheck
Master cannot read a valueListening channel, bind address, station, function code, target variable property, and data type.
Client cannot connectChannel type, local bind address, port, firewall, maximum connections, and client permission list.
Value has wrong byte orderData format, string-byte setting, target data type, and external master format.
Write is rejectedTarget RPC write, variable RPC write, client permission, and the external master's function code.
Serial server has no responsePort ownership, baud rate, data bits, parity, stop bits, flow control, and frame timing.