Skip to main content

Modbus Master

The Modbus Master plugin reads and writes Modbus TCP, RTU, and ASCII devices.

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.

Read one known holding register​

  1. Create a TCP client channel with the device's actual endpoint, for example 192.168.1.10:502.
  2. Add a Modbus Master device, select ModbusTcp, and enter its actual station number. Start with a 1000 ms execution interval and default advanced settings.
  3. Add an enabled Int16 point at 40001 if the first holding register is a signed 16-bit value.
  4. Compare its value, quality, and advancing collection time with a known source value before expanding the point table.

For RTU or ASCII, select a serial channel and match port, baud rate, data bits, stop bits, and parity. RTU over TCP still carries RTU frames. Verify MBAP for Modbus TCP, CRC for RTU, and text framing/LRC for ASCII; renaming a channel does not change framing.

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 typeCheck before configuration
TCP clientConfirm the device IP, port, and network reachability from the gateway.
TCP serverConfirm the local listening address and port, and that the field device can connect to the gateway.
Serial portConfirm that the port is not in use and that baud rate, data bits, stop bits, and parity match the device.
UDPConfirm 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​

SettingDescription
Modbus typeSelect ModbusTcp, ModbusRtu, or ModbusAscii to match the field device and channel.
Default stationStation used when the variable address does not specify one. The default is 1.

Runtime and data format​

SettingDescription
Read/write timeoutDefault 3000 ms for a protocol response; independent of the collection interval.
Failure retriesDefault 3. Error type and driver policy determine actual retries; include their requests and waiting time.
Pre-frame delayDefault 0 ms before sending. Multiple requests each incur the delay; this does not configure RTU frame boundaries.
Read/write duty cycleDefault 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 priorityDefault off. Affects supported scheduling under contention; verify write results and source feedback separately.
Data formatDefault ABCD; choose ABCD, BADC, CDAB, or DCBA to match the point table. Address option data= can override a single point.
String byte reversalDefault 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.

SettingRange / defaultDescription
FC1 maximum coils1–2000, default 1600Maximum coil bits read in one FC1 request.
FC2 maximum discrete inputs1–2000, default 1600Maximum discrete-input bits read in one FC2 request.
FC3 maximum holding registers1–125, default 100Maximum holding registers read in one FC3 request.
FC4 maximum input registers1–125, default 100Maximum input registers read in one FC4 request.
FC15 maximum multiple-coil write1–1968, default 1968Maximum coil bits written in one FC15 request.
FC16 maximum multiple-register write1–123, default 123Maximum registers written in one FC16 request.

DTU connection​

SettingDescription
DTU IDIdentifier used to match a registered DTU connection when the channel is a DTU service. Leave it empty for ordinary direct connections.

When the channel type is a DTU service, DTU ID must exactly match the identifier registered in DTU Service. Leave it empty for direct TCP, serial, or UDP channels.

Address rules​

Use the address area that matches the Modbus function:

Address rangeArea
00001 onwardCoils
10001 onwardDiscrete inputs
30001 onwardInput registers
40001 onwardHolding registers

Examples:

  • 40001 is the first holding register.
  • 40001;s=2; reads station 2 instead of the default station.
  • 40001;w=16; uses function code 16 when writing the value.
  • F=3;100 explicitly uses function code 3 at protocol offset 100 for a holding-register read. With F=, the address is a zero-based offset rather than a 40001-style area address.
  • Combine options with semicolons, for example S=2;F=3;100. The options apply to this variable address only.

W= accepts a positive write function code; 15 (multiple coils) and 16 (multiple registers) are the usual values. When it is omitted, the write function follows the variable data type and protocol defaults.

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, and click More Functions, then open Debug.

Read and write​

Modbus Master read and write debug panel

Read a confirmed safe address first. Before writing, confirm the variable permission, station, function code, data type, and field safety conditions.

Messages​

Modbus Master message panel

Use the message view to check sent and received frames, connection failures, and protocol parsing errors.

Functions​

FunctionPurpose
Read and writeRead a confirmed point and write only to an approved test point.
MessagesView sent and received frames, protocol fields, and error details.

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​

  1. Read one confirmed field address.
  2. Confirm that the returned value, data type, byte order, station, and function code match the point list.
  3. For a writable point, write a safe value and read it back according to the field procedure.
  4. Only after the single-point check passes should you import the complete point list.

Troubleshooting​

SymptomCheck
Address read failsCheck the address area, station suffix, data type, and device point list.
Serial device does not respondCheck port ownership, baud rate, data bits, stop bits, parity, and channel type.
TCP device does not respondCheck the remote or bind address, firewall, station, and Modbus type.
Values are shifted or incorrectCheck data type, byte order, array length, and the address offset.
Batch read is rejectedReduce the corresponding FC1–FC4 limit and compare it with the device manual.
Batch write is rejectedKeep FC15 between 1–1968 and FC16 between 1–123, then compare the configured limit with the device manual.