On this page
Modbus master
The Modbus master plugin reads and writes Modbus TCP, RTU, and ASCII devices.
Compatible devices and models
| Device series / model examples | Connection requirements |
|---|---|
| PLCs, instruments, drives and I/O modules supporting Modbus TCP, RTU or ASCII | Enable the corresponding Modbus slave/server. Match station, function code, register offset, data type and byte order to the device register map. |
| Inovance H5U, Easy320, Easy52X (Modbus TCP) | Use the PLC Modbus TCP slave and numeric register addresses and function codes from its register map. Convert device names such as D/M first; FINS and EasyNet addresses do not apply unchanged. |
| Omron CP2E-S, CP2E-N (Modbus RTU) | Enable Modbus RTU slave mode on an available serial port. W maps to coils and D to holding registers; use numeric addresses and supported function codes from the CP2E manual. The Ethernet FINS interface is a different service from Modbus TCP. |
| FATEK B1, B1z (Modbus interfaces) | Select Modbus RTU/ASCII on a serial port supporting that mode. B1 with a B1-CM25E/B1-CM55E module can use Modbus TCP server, default port 502. Use numeric Modbus addresses. The FATEK standard protocol, default port 500, uses the Program plugin. |
| Delta DVP, AS300 (Modbus interfaces) | Enable a Modbus slave on the actual CPU or communication module and use numeric addresses from the matching series register map. Select the Delta plugin and correct series mapping to use device names such as X/Y/M/D directly. |
Open the plugin
Open Development Configuration → Collection Configuration, create a device, and select Modbus master as the collection plugin.
Create the channel and device through Collection Configuration. This page lists only Modbus-specific settings, addresses, and debug actions.
Configure the source service and register map
Enable a Modbus slave/server in the PLC engineering software or instrument settings. The gateway initiates requests; two client endpoints cannot communicate with each other. Record the actual IP/port or serial settings, station, and a safe readable test point. Download the settings and confirm that the source is running. TCP commonly uses port 502, but use the configured port.
The register map must identify area, protocol offset, type, width, byte order, and access permission. For FC03, offset 0, signed 16-bit, known value 1234, use F=3;0, Int16, array length 0 (scalar). A map using reference 40001 identifies the same register; do not send offset 40001. Names such as D0 or M0 require the specific PLC’s Modbus mapping before use here.
Prepare a known value in Modbus Slave
These screenshots use Modbus Slave 7.4.1 on the same computer as the gateway. This is a software test. For a physical PLC, use its server configuration and online monitor value. See the connection, slave-definition, and communication-monitor sections of the official tool manual .
-
Press F8 / Slave Definition. Set Slave ID
1, Function03 Holding Register (4x), address modeDec, Address0, and Quantity10. Leave error simulation off. The dialog shows PLC address40001beside protocol Address0.
-
Confirm, double-click the first value cell, and enter
1234using signed 16-bit display. In F3 / Connection Setup, selectModbus TCP/IP, clearAny Address, and bind127.0.0.1, port15020. LeaveIgnore Unit IDclear so that a wrong station can be detected. Confirm and keep the server listening.
127.0.0.1 applies only when both processes share the same host network. From another computer or container, it identifies the gateway itself. Bind the tool to a reachable interface and use that interface address from the gateway.
Create the channel, device, and variable
-
In Development Configuration → Collection Configuration, add enabled channel
ModbusSlave_TCP, type TcpClient, endpoint127.0.0.1:15020. For a physical TCP device, use its actual endpoint, such as192.168.1.10:502. Channel connection timeout and plugin response timeout serve different purposes; see Channels and transport.
-
Add device
ModbusSlave_Test, select Modbus master, associate the channel, and set the execution interval to1000ms.
-
In Plugin Properties, select
ModbusTcp, station1, and default packing limits. Leave DTU ID and heartbeat empty for this direct connection. Save the device.
Scroll down in Plugin Properties for timeout, retries, scheduling and data format. This example keeps timeout
3000ms, frame delay0ms, retries3, write/read ratio3, write priority off, string byte reversal off andABCD. For multi-register values on other devices, select the byte order specified in their register map.
-
Add enabled variable
Holding_40001, address40001, typeInt16, and array length0(scalar). The example allows read/write; choose read-only when only collecting. Gateway permission cannot make a read-only source register writable.
-
Open Field Editor beside the address. Confirm
HoldingRegisters, offset0, and no optional overrides. Confirm and fill back: the address becomesF=3;0. Save the outer variable dialog as well; filling back alone does not save it.
-
Confirm an online device, an available runtime instance, value
1234, and advancing collection time. Compare with the source register; an online TCP connection alone does not validate the address map.
For RTU or ASCII, select a serial channel and match port, baud rate, data bits, stop bits, and parity. Select ModbusRtu or ModbusAscii to match the source. Unicast serial stations normally use 1–247; broadcast 0 is unsuitable for a read test. Match RS-485 D+/D− or A/B using both device manuals because labels differ between vendors; follow their requirements for reference ground, shielding, and end termination. RS-232 cannot connect directly to RS-485 A/B. Release the port from other tasks or tools before enabling the gateway. An Ethernet converter transparently carrying RTU frames still requires ModbusRtu; a Modbus TCP server requires ModbusTcp.
Verify MBAP for Modbus TCP, CRC for RTU, and text framing/LRC for ASCII. Renaming a channel does not change framing. The gateway Messages panel can show connection/receive summaries without raw bytes; use the source communication monitor or packet capture when checking station and function bytes.
In device debugging, 40001 and F=3;0 should read the same register. Stop affected tasks before reconfiguring a serial link. Test coils and registers separately before adding arrays: array length counts elements, while packing limits count bits or registers. After a permitted write to a safe point, verify through an independent master and then a new gateway sample.
See Channels and transport and Batch configuration.
Supported channels and data types
| Channel type | Check before configuration |
|---|---|
| TCP client | Confirm the device IP, port, and network reachability from the gateway. |
| TCP server | Confirm the local listening address and port, and that the field device can connect to the gateway. |
| Serial port | Confirm that the port is not in use and that baud rate, data bits, stop bits, and parity match the device. |
| UDP | Confirm the bind address, port, firewall rules, and packet source. |
Supported data types: Boolean, Byte, Int16, UInt16, Int32, UInt32, Int64, UInt64, Float, Double, String, and Decimal.
Plugin properties
Configure channel type, endpoints, serial settings, TLS, connection timeout, and channel concurrency in the associated channel. Open its editor beside Associated Channel in the device editor. Retry count, read/write duty cycle, write priority, protocol timeout, data format, and string byte reversal are device plugin properties. See Collection Configuration for shared fields. The tables below list Modbus-specific settings.
Protocol
| Setting | Description |
|---|---|
| Modbus type | Select ModbusTcp, ModbusRtu, or ModbusAscii to match the field device and channel. |
| Default station | Default 1, used unless the variable specifies S=. Serial unicast normally uses 1–247. TCP Unit ID follows the device or bridge requirement; it is not derived from the last part of the IP address. |
Runtime and data format
| Setting | Description |
|---|---|
| Read/write timeout | Default 3000 ms for a protocol response; independent of the collection interval. |
| Failure retries | Default 3. Error type and driver policy determine actual retries; include their requests and waiting time. |
| Pre-frame delay | Default 0 ms before sending. Multiple requests each incur the delay; this does not configure RTU frame boundaries. |
| Read/write duty cycle | Default 3. Under sustained read/write contention, counts writes before giving waiting reads an opportunity. It is not a percentage or a guaranteed 3:1 ratio in every observation window. |
| Write priority | Default off. Affects supported scheduling under contention; verify write results and source feedback separately. |
| Data format | Default ABCD; choose ABCD, BADC, CDAB, or DCBA to match the point table. Address option data= can override a single point. |
| String byte reversal | Default off. Swaps the two characters inside each word: the same ASCII source PLC001 becomes LP0C10. This is separate from numeric byte order and text encoding. |
Request packing
These limits count bits or registers in each request; variable rows can occupy different widths. Keep the defaults unless the device manual specifies a smaller limit.
| Setting | Range / default | Description |
|---|---|---|
| FC1 maximum coils | 1–2000, default 1600 | Maximum coil bits read in one FC1 request. |
| FC2 maximum discrete inputs | 1–2000, default 1600 | Maximum discrete-input bits read in one FC2 request. |
| FC3 maximum holding registers | 1–125, default 100 | Maximum holding registers read in one FC3 request. |
| FC4 maximum input registers | 1–125, default 100 | Maximum input registers read in one FC4 request. |
| FC15 maximum multiple-coil write | 1–1968, default 1968 | Maximum coil bits written in one FC15 request. |
| FC16 maximum multiple-register write | 1–123, default 123 | Maximum registers written in one FC16 request. |
DTU connection
| Setting | Description |
|---|---|
| DTU ID | Empty by default. Identifies the inbound DTU connection assigned to this device in TCP server DTU mode. It is separate from the Modbus station. Leave empty for direct TCP, serial, or UDP connections. |
| Heartbeat content | Empty inherits the channel heartbeat; a nonempty value overrides it. Applies only to the default TCP Server DTU mode, identifying and echoing that device’s heartbeat. Match the actual DTU payload; this is neither a Modbus read command nor a collection interval. |
| Heartbeat is Hex | Default off: UTF-8 text matching. Enable for hexadecimal byte matching. Text PING and bytes 50 49 4E 47 require the corresponding input mode. This changes neither Modbus framing nor channel DTU ID encoding. |
See DTU Service for TCP server identification rules. A connected socket can still fail to match this device when its identifier is wrong; a mismatched heartbeat can reach protocol parsing. Check those settings before changing the Modbus station.
Address rules
Use the address area that matches the Modbus function:
| Address range | Area |
|---|---|
00001 onward | Coils |
10001 onward | Discrete inputs |
30001 onward | Input registers |
40001 onward | Holding registers |
Examples:
40001is the first holding register.40001;s=2;reads station2instead of the default station.40001;w=16;uses function code16when writing the value.F=3;100explicitly uses function code3at protocol offset100for a holding-register read. WithF=, the address is a zero-based offset rather than a40001-style area address.- Combine options with semicolons, for example
S=2;F=3;100. The options apply to this variable address only.
The address editor offers write functions 5 (single coil), 6 (single register), 15 (multiple coils), and 16 (multiple registers). Leave the override unset to use the area’s/type’s write defaults. Do not select a coil function for a holding register or a single-register function for a value spanning multiple registers. Override only when required by the source manual.
Address editor fields
Choose the variable type, array length, and permission before editing the address; they affect allowed areas and access width.
| Field | Purpose and input |
|---|---|
| Read area | Coils/01, DiscreteInputs/02, HoldingRegisters/03, or InputRegisters/04. Read/write and write-only variables offer only coils and holding registers. Set read-only first for input areas. Bit areas use one bit per address; register areas use 16 bits per address. |
| Start offset | 0–65535, always zero-based within the area. Do not include the 4xxxx reference prefix: 40001 is holding offset 0, 40002 is 1. The entire array or multibyte value must fit the source map. |
| Bit offset | Unset adds no suffix. For a register Boolean, use 0–15; F=3;0.1 identifies bit 1 in the first register. Coil/input-bit areas reject bit suffixes. Periodic Byte handling is described below. |
| Station override | Unset inherits the device station; a set value must be 1–247, for example F=3;0;S=2. A variable’s name does not select its station. |
| Write function override | Select supported function 5/6/15/16 only when required. Does not change the read area or offset. |
| Byte order override | Unset inherits device data format; options are ABCD/BADC/CDAB/DCBA. F=3;0;data=CDAB exchanges 32-bit word order without moving the address. |
| Encoding override | For strings, use the actual storage encoding, such as ASCII or UTF-8; leave unset for ordinary numbers. The runtime must support the encoding name. |
| String byte length | Required for String access. The field permits 0–65535; use a positive valid storage length for ordinary reads. F=3;0;len=6;encoding=ASCII occupies six bytes/three registers. This is neither character count nor array element count. |
| BCD override | C8421/C5421/C2421/C3/Gray, for String conversion when the source uses that encoding. Bytes 12 34 in two-byte 8421 BCD can use len=2;bcd=C8421. Ordinary binary integer 04 D2 needs no BCD override. |
| Variable string length override | A shared conversion field; unset and explicit false are preserved separately. Ordinary Modbus registers have no S7 STRING header. This plugin still uses len= to determine access width; this option does not discover the PLC text length or reduce register reads. |
Enable an override to specify a valid value; clear its checkbox to remove it. Manual options data/encoding/len/bcd/vsl correspond to these fields. Do not duplicate an option or overwrite manual syntax that the editor cannot fully represent.
See Common variable register options for data, len, bcd, encoding, and combined examples. Verify the address against the device point list before importing many variables.
Device debug
Open Development Configuration → Collection Configuration, select the Modbus device, open Protocol Debug at the top of the workspace.
Read and write

Read the same address F=3;0, type Int16, quantity 1; it should match the periodic value. Before writing, confirm the variable permission, station, function code, data type, and field safety conditions. In this isolated software slave, a write from 1234 to 2345 changed the source table to 2345. A subsequent write restored 1234, followed by a successful fresh read. Check the source and a new sample; an old result box is insufficient.


Messages

Start temporary capture, reproduce the read, then stop capture. Inspect connection and protocol errors. In this example the gateway shows connection and Received summaries; inspect the raw bytes in Modbus Slave’s Display → Communication:

Rx means a request received from the gateway; Tx means a response sent to it. After the changing two-byte transaction ID, request … 00 00 00 06 01 03 00 00 00 01 has protocol ID 0, remaining length 6, Unit ID 1, FC03, offset 0, and quantity 1. Response … 00 00 00 05 01 03 02 04 D2 contains two data bytes, 0x04D2 = 1234. RTU uses CRC and ASCII uses LRC; neither uses this MBAP header.
Functions
| Function | Purpose |
|---|---|
| Read and write | Read a confirmed point and write only to an approved test point. |
| Messages | Inspect connection/receive summaries and errors; use source monitoring or capture when raw protocol bytes are needed. |
Register bits and Byte reads
For a holding-register Boolean, .0–.15 selects a bit. With known source bytes 04 D2 (1234), 40001.0 is false and 40001.1 is true. A nonzero whole register does not make every bit true.
Check periodic collection and single-Byte debugging separately. For the same 04 D2 source, a periodic Byte point at 40001.0 can return low byte 210. The debug Read/Write single-Byte operation returns the first response byte, 4; adding .1 there does not select the low byte. Compare the business point and raw frame when validating the point-table mapping.
Array length counts elements: three Int16 elements occupy three registers; three Float elements occupy six. If one array exceeds the slave request limit, shorten or split it instead of adjusting the number of variable rows.
One array write must also fit the FC15/FC16 limit; a smaller limit does not automatically split it. Writing three Int16 elements is rejected with FC16 set to 2; a limit of 4 allows it only if the slave supports that range. Inspect every address result in a batch rather than treating outer-request success as complete success.
Decimal uses a sixteen-byte representation occupying eight holding registers, not a universal PLC decimal format. Choose scaled integers, Float, or Double according to the device layout. For 64-bit counters, compare source bytes and the receiver’s complete integer representation; an approximate browser number is insufficient to confirm precision.
Verify the configuration
- Read one confirmed field address.
- Confirm that the returned value, data type, byte order, station, and function code match the point list.
- For a writable point, write a safe value and read it back according to the field procedure.
- Only after the single-point check passes should you import the complete point list.
Troubleshooting
| Symptom | Check |
|---|---|
| Address read fails | Check the address area, station suffix, data type, and device point list. |
| Serial device does not respond | Check port ownership, baud rate, data bits, stop bits, parity, and channel type. |
| TCP device does not respond | Check the remote or bind address, firewall, station, and Modbus type. |
| Values are shifted or incorrect | Check data type, byte order, array length, and the address offset. |
| Batch read is rejected | Reduce the corresponding FC1–FC4 limit and compare it with the device manual. |
| Batch write is rejected | Keep FC15 between 1–1968 and FC16 between 1–123, then compare the configured limit with the device manual. |
Related links
- Collection Configuration: Channels, devices, variables, import, and common debug entry.
- Plugin Manual Index: Other collection and data-forwarding plugins.