Modbus Client-Server Principle
Overview
The Modbus RTU protocol exchanges information using a request-reply mechanism between a client and a server. The client-server principle is a model for a communication protocol in which one device (the client) controls one or more other devices (the servers). In a standard Modbus network, there is one client and up to 31 servers.
A detailed description of the Modbus protocol is available at www.modbus.org.
Characteristics of the Client-Server Principle
The client-server principle is characterized as follows:
-
Only one client is connected to the network at a time.
-
Only the client can initiate communication and send requests to the servers.
-
The client can address each server individually using its specific address or all servers simultaneously using address 0.
-
The servers can only send replies to the client.
-
The servers cannot initiate communication, either to the client or to other servers.
Client-Server Communication Modes
The Modbus RTU protocol can exchange information using the two communication modes:
-
request-reply mode
-
broadcast mode
Request-Reply Mode
Broadcast Mode
Response Time
Values with the Modbus protocol are:
-
Typical value < 10 ms for 90% of the exchanges
-
Maximum value is around 700 ms. Hence it is recommended to implement a 1 second time-out after sending a Modbus request.
Data Exchange
The Modbus protocol uses 2 types of data:
-
bits
-
16-bit words called registers
VigiPacT relays support both types of data.
Each register has a register number. Each type of data (bit or register) has a 16-bit address.
The messages exchanged with the Modbus protocol contain the address of the data to be processed.
Registers and Addresses
The address of register number n is n-1. The tables detailed in the following parts of this document provide both register numbers (in decimal format) and corresponding addresses (in hexadecimal format). For example, the address of register number 100 is 0x0063 (99).
Frames
All the frames exchanged with the Modbus protocol have a maximum size of 256 bytes and are composed of 4 fields:
Field |
Definition |
Size |
Description |
---|---|---|---|
1 |
Server number |
1 byte |
Destination of the request:
|
2 |
Function codes |
1 byte or 2 bytes |
Refer to Modbus Functions |
3 |
Data |
n registers |
Request or reply data |
4 |
Check |
2 bytes |
CRC16 (to check transmission errors) |