MODBUS Client
MODBUS Client communication protocol
The protocol implements client (master) communication with arbitrary devices that support MODBUS RTU or MODBUS ASCII standards (serial communication) as well as MODBUS over TCP/IP. Moreover, it supports two extensions:
Byte mode - allows working with devices that implement the registers as 1-byte variables (in contrast with Modbus standard in which the register value is 2 bytes).
Variable mode - allows working with devices that implement the registers with different sizes than standard 2 bytes. It was implemented because of support of the flowmeter FloBoss 103 made by Fisher Controls International (at this time a part of Emerson Process Management): 1-byte variables, 4-byte unsigned/signed integers, text strings of length 10,12,20,40 characters, a 6-byte time stamp, and other.
Note: this mode enables work with devices implementing the so-called Enron Modbus or Daniel Modbus.Passive (scanning) mode allows to work in eavesdropping mode. This applies especially to serial communication when the communication port of the device is already used to communicate with another Master device. Due to the nature of the Modbus protocol, it is necessary to receive both requests and responses in this mode.
Line category Serial (serial communication)
Line category SerialOverUDP Device Redundant (serial communication).
Line category RFC2217 Client (serial communication).
Line category TCP/IP-TCP and TCP/IP-TCP Redundant (MODBUS over TCP/IP). Reserved TCP port 502 is commonly used, but it is possible to use any other one according to the setting of the device. The line number is not used, set the value e.g. to 1.
Note: For redundant systems, it is possible to enter multiple names/addresses separated by commas.
Note: In the case of WAGO 750-8100 type PLC and communication via MODBUS TCP, it was necessary to set a small polling period (e.g. 1 second) in the time parameters of the station. In the case of a longer period (5 seconds), the connection was closed quite often by the PLC.
Forced disconnection: If all stations on the TCP/IP-TCP or TCP/IP-TCP Redundant line are in the simulation mode or the communication is stopped for them, the line will be disconnected (the communication socket will be closed). If the simulation is disabled for at least one station and the communication is not stopped for it (the Parameters tab of the Station type object), the line will be connected again.
A dialog window of communication line configuration - Protocol parameters tab.
They influence some optional protocol parameters.
The line protocol contains the following parameters:
Parameter | Meaning | Unit | Default value |
|---|---|---|---|
Immediate Disconnect | The parameter is implemented only for TCP/IP-TCP and TCP/IP-TCP Redundant line categories. The parameter activates the disconnection of the TCP connection after the execution of each read cycle, or after the value is written. The parameter was implemented due to problems with connection stability on mobile GPRS networks. | YES/NO | NO |
Passive Mode | This parameter activates the passive (scanning) mode. In this mode, requests are not sent and writing does not work. Only received packets are parsed. The nature of the Modbus protocol implies that it is necessary to receive both the requests and responses of existing communication. | YES/NO | NO |
TCP No Delay | Setting the TCP No Delay parameter to YES causes the low-level socket option TCP_NODELAY to be set, thus turning off the default packet coalesce feature. | YES/NO | NO |
Communication protocol "Modbus Client".
The station address is a decimal number mostly in the range of 1 up to 247. Address 0 is reserved as broadcast.
Station protocol parameters
Configuration dialog box - tab Parameter.
They influence some optional parameters of the protocol. The following station protocol parameters can be set:
Table 1
Parameter | Meaning | Unit | Default value |
|---|---|---|---|
Retry Count | Maximum count of request retries. If no response returns after a request has been sent, the station's status will change to a communication error. | - | 2 |
Retry Timeout | Timeout before resending a request if no response has been received. | s | 0.1 |
Wait First Timeout | The delay after sending the request and before reading the response. | s | 0.1 |
Wait Timeout | The delay between the response readings. | s | 0.1 |
Max. Wait Retry | The maximum number of retries of the response reading. | - | 20 |
Start Silent Interval | "Start silent interval" before the beginning of the transmission in RTU mode. | ms | 50 |
Stop Silent Interval | "Stop silent interval" after ending of the transmission in RTU mode. | ms | 50 |
Read After Write | After writing to the I/O tag, the reading immediately follows. By setting the parameter to the NO value, it is possible to reduce the load on communications (especially serial ones) with a large number of writes. | YES/NO | YES |
Little Endian Mode | Byte order in Little-endian mode for 4-byte variables. The individual options indicate in which bytes (1-lowest, 4-highest) the individual bytes from the communication will go:
| - | 2143 |
Byte mode | Special byte mode of transmission in which the values of registers have a length of 1 byte and not 2 bytes as it is defined in Modbus protocol specification. | YES/NO | NO |
Variable mode | Special variable mode of transmission in which the values of registers have variable lengths. The setting of Variable mode: Note 1: Variable and byte modes are incompatible and only one of them can be enabled. | OFF | OFF |
Full debug | Logging of detailed debug information about communication in the line log. | YES/NO | NO |