Skip to content

Modbus RTU

Modbus RTU is a version of the Modbus protocol that is based on serial communication. Unlike the Modbus TCP protocol, Modbus RTU is typically used to connect sensors, actuators, and other control devices on a factory production line. It is a fast, reliable, and flexible serial communication protocol that provides reliable data transmission and control functions.

The Modbus RTU protocol uses binary encoding and can transmit data over RS-232, RS-485, or other serial communication media. Neuron Modbus RTU plugin adds an implementation based on Ethernet TCP and enables remote device data acquisition and control through a DTU device.

Add Device

Go to Configuration -> South Devices, then click Add Device to add the driver. Configure the following settings in the popup dialog box.

  • Name: The name of this device node.
  • Plugin: Select the Modbus RTU plugin.

Device Configuration

After clicking Create, you will be redirected to the Device Configuration page, where we will set up the parameters required for Neuron to establish a connection with the device. You can also click the device configuration icon on the southbound device card to enter the Device Configuration interface.

ParameterDescription
Physical LinkSelects the communication medium, either serial or Ethernet.
Connection TimeoutThe time the system waits for a device to respond to a command.
Maximum Retry TimesThe maximum number of retries after a failed attempt to send a read command.
Retry IntervalResend reading instruction interval(ms) after a failed attempt to send a read command.
Send IntervalThe waiting time between sending each read/write command. Some serial devices may discard certain commands if they receive consecutive commands in a short period of time.
EndiannessByte order of tags with 32 bits, ABCD corresponds to 1234.
Start AddressAddress starts from 1 or 0.
Serial DeviceOnly needed in Serial mode, the path to the serial device when using a serial connection, e.g., /dev/ttyS0 in Linux systems.
Stop BitsOnly for the Serial mode, the serial connection parameter.
ParityOnly for the Serial mode, the serial connection parameter.
Baud RateOnly for the Serial mode, the serial connection parameter.
Data BitsOnly for the Serial mode, the serial connection parameter.
Connection ModeOnly for the Ethernet mode, you can choose Neuron as the TCP client or server.
IP AddressOnly for the Ethernet mode, the IP address of the device when using TCP connection with Neuron as the client, or the IP address of Neuron when using TCP connection with Neuron as the server. The default value is 0.0.0.0.
PortOnly for the Ethernet mode, the port number of the device when using TCP connection with Neuron as the client, or the port number of Neuron when using TCP connection with Neuron as the server.
Device DegradationEnable or disable device degradation mechanism.
Failure Threshold for DegradationThe number of consecutive failure cycles required to trigger device degradation.
Recovery Time After DegradationThe time in seconds after which the device recovers from degradation.

TIP

The above configuration can meet the individualized needs of the device:

  1. Retry requests are considered as the same request, i.e., a successful retry is regarded as a successful request.
  2. In the same read cycle, if a certain tag under a slave id does not receive a response, requests for other tags under the same slave id in that cycle will be skipped.
  3. The device degradation is triggered when a certain tag under a slave id fails to respond for multiple consecutive cycles (or can be configured to trigger after just one failed cycle). Once triggered, all requests for that slave will be stopped for the configured period.

Configure Data Groups and Tags

After the plugin is added and configured, the next step is to establish communication between your device and Neuron by adding groups and tags to the Southbound driver.

Once device configuration is completed, navigate to the South Devices page. Click on the device card or device row to access the Group List page. Here, you can create a new group by clicking on Create, then specifying the group name and data collection interval.

Upon successfully creating a group, click on its name to proceed to the Tag List page. This page allows you to add device tags for data collection. You'll need to provide information such as the tag address, attributes, and data type.

For information on general configuration items, see Connect to Southbound Devices. The subsequent section will concentrate on configurations specific to the driver.

Data Types

  • INT16
  • UINT16
  • INT32
  • UINT32
  • INT64
  • UINT64
  • FLOAT
  • DOUBLE
  • BIT
  • STRING

Address Format

SLAVE!ADDRESS[.BIT][#ENDIAN][.LEN[H][L][D][E]][.BYTES]

SLAVE

Required, Slave is the slave address or site number.

ADDRESS

Required, Address is the register address. The Modbus protocol has four areas, each area has a maximum of 65536 registers, and the address range of each area is shown in the table below. It should be noted that a storage area as large as 65536 is generally not required in practical applications. Generally, PLC manufacturers generally use an address range within 10000. Please pay attention to fill in the correct point address according to the area and function code of the device.

AreaAddress RangeAttributeRegister SizeFunction CodeData Type
Coil000001 ~ 065536Read/Write1Bit0x01, 0x05, 0x0fBIT
Input100001 ~ 165536Read/Write1Bit0x02BIT
Input Register300001 ~ 365536Read/Write16Bit,2Byte0x04BIT, INT16, UINT16,
INT32, UINT32,
INT64, UINT64,
FLOAT, DOUBLE, STRING
Hold Register400001 ~ 465536Read/Write16Bit,2Byte0x03, 0x06, 0x10BIT, INT16, UINT16,
INT32, UINT32, INT64,
UINT64, FLOAT, DOUBLE,
STRING

.BIT

Optional, specify a specific bit in a register.

AddressData TypeDescription
1!300004.0bitRefers to station 1, input register area, address 300004, bit 0
1!400010.4bitRefers to station 1, hold register area, address 400010, bit 4
2!400001.15bitRefers to station 2, hold register area, address 400001, bit 15

#ENDIAN

Optional, byte order, applicable to data types int16/uint16/int32/uint32/float, see the table below for details.

SymbolByte OrderSupported Data TypesNote
#B2,1int16/uint16
#L1,2int16/uint16Default byte order if not specified
#LL1,2,3,4int32/uint32/floatDefault byte order if not specified
#LB2,1,4,3int32/uint32/float
#BL3,4,1,2int32/uint32/float
#BB4,3,2,1int32/uint32/float

TIP

The byte order of a tag has a higher priority than the byte order configuration of a node. That is to say, once the byte order is configured for a tag, it follows the configuration of that tag and ignores the node configuration. The byte order can be illustrated using the notation ABCD, which corresponds directly to the sequence 1234. As an example, the ABCD designation represents the standard or default Endianness 1234. (#LL).

.LEN[H][L][D][E]

When the data type is STRING, .LEN is a required field, indicating the number of bytes the string occupies. Each register contains four storage methods: H, L, D, and E, as shown in the table below.

SymbolDescription
HOne register stores two bytes, with the high byte first
LOne register stores two bytes, with the low byte first
DOne register stores one byte, and it is stored in the low byte
EOne register stores one byte, and it is stored in the high byte

.BYTES

Optional, read and write the length of bytes type data, applicable to bytes data type.

TIP

A register of the Modbus driver contains 2 bytes. When reading and writing Modbus register data in the bytes data type, please ensure that the bytes parameter is set to an even number.

Example Addresses

AddressData TypeDescription
1!300004int16Refers to station 1, input register area, address 300004, byte order #L
1!300004#Bint16Refers to station 1, input register area, address 300004, byte order #B
1!300004#Luint16Refers to station 1, input register area, address 300004, byte order #L
1!400004int16Refers to station 1, hold register area, address 400004, byte order #L
1!400004#Lint16Refers to station 1, hold register area, address 400004, byte order #L
1!400004#Buint16Refers to station 1, hold register area, address 400004, byte order #B
1!300004int32Refers to station 1, input register area, address 300004, byte order #LL
1!300004#BBuint32Refers to station 1, input register area, address 300004, byte order #BB
1!300004#LBuint32Refers to station 1, input register area, address 300004, byte order #LB
1!300004#BLfloatRefers to station 1, input register area, address 300004, byte order #BL
1!300004#LLint32Refers to station 1, input register area, address 300004, byte order #LL
1!400004int32Refers to station 1, hold register area, address 400004, byte order #LL
1!400004#LBuint32Refers to station 1, hold register area, address 400004, byte order #LB
1!400004#BBuint32Refers to station 1, hold register area, address 400004, byte order #BB
1!400004#LLint32Refers to station 1, hold register area, address 400004, byte order #LL
1!400004#BLfloatRefers to station 1, hold register area, address 400004, byte order #BL
1!300001.10StringRefers to station 1, input register area, address 300001, character length 10, byte order L, which occupies addresses 300001 to 300005
1!300001.10HStringRefers to station 1, input register area, address 300001, character length 10, byte order H, which occupies addresses 300001 to 300005
1!300001.10LStringRefers to station 1, input register area, address 300001, character length 10, byte order L, which occupies addresses 300001 to 300005
1!400001.10StringRefers to station 1, hold register area, address 400001, character length 10, byte order L, which occupies addresses 400001 to 400005
1!400001.10HStringRefers to station 1, hold register area, address 400001, character length 10, byte order H, which occupies addresses 400001 to 400005
1!400001.10LStringRefers to station 1, hold register area, address 400001, character length 10, byte order L, which occupies addresses 400001 to 400005
1!400001.10DStringRefers to station 1, hold register area, address 300001, character length 10, byte order D, which occupies addresses 400001 to 400005
1!400001.10EStringRefers to station 1, hold register area, address 300001, character length 10, byte order E, which occupies addresses 400001 to 400005

Use Case

This chapter also provides practical examples to facilitate a quick start.

Data Monitoring

After completing the point configuration, you can click Monitoring -> Data Monitoring to view device information and control devices. For details, refer to Data Monitoring.