Modbus communication protocol

Modbus is a data communications protocol originally published by Modicon (now Schneider Electric) in 1979 for use with its programmable logic controllers (PLCs). Modbus has become a de facto standard communication protocol and is now a commonly available means of connecting industrial electronic devices.[1]

Modbus is popular in industrial environments because it is openly published and royalty-free. It was developed for industrial applications, is relatively easy to deploy and maintain compared to other standards, and places few restrictions – other than the datagram (packet) size – on the format of the data to be transmitted.

The Modbus protocol uses character serial communication linesEthernet, or the Internet protocol suite as a transport layer.

Modbus supports communication to and from multiple devices connected to the same cable or Ethernet network. For example, there can be a device that measures temperature and another device to measure humidity connected to the same cable, both communicating measurements to the same computer.

Modbus is often used to connect a plant/system supervisory computer with a remote terminal unit (RTU) in Supervisory Control and Data Acquisition (SCADA) systems in the electric power industry. Many of the data types are named from industrial control of factory devices, such as Ladder logic because of its use in driving relays: A single physical output is called a coil, and a single physical input is called a discrete input or a contact.

Modbus has the following characteristics:

● The standard is open, users can use the Modbus protocol for free and with confidence, without paying license fees, and will not infringe on intellectual property rights.

● Modbus supports a variety of electrical interfaces, such as RS232, RS485, etc., and can also be transmitted on various media, such as twisted pair, optical fiber, wireless, etc.

● Modbus protocol frame format is simple, compact, easy to understand, easy for users to use, and easy for manufacturers to develop

Two transmission modes of MODBUS network

The controller can be set to any one of two transmission modes (ASCII or RTU) to communicate on a standard Modbus network. The user selects the desired mode, including serial communication parameters (baud rate, calibration mode, etc.). When configuring each controller, all devices on a Modbus network must select the same transmission mode and serial port parameters.

●ASCII mode

When the controller is set to communicate in ASCII (American Standard Code for Information Exchange) mode on the Modbus network, each 8Bit byte in the message is sent as an ASCII code (two hexadecimal characters). The main advantage of this method is that the time interval for sending characters can reach 1 second without error.

●RTU mode

When the controller is set to communicate in RTU (Remote Terminal Unit) mode on the Modbus network, each 8Bit byte in the message contains two 4Bit

Hexadecimal characters.

The main advantage of this method is: Under the same baud rate, more data can be transmitted than ASCII mode.

Modbus RTU information frame

Modbus information is transmitted in frames. Each frame has a definite start point and end point, so that the receiving device starts to read the address at the beginning of the message, and determines the device to be addressed and the end time of the information transmission.

The characters allowed to be sent in each area are hexadecimal 0-9, AF.

Devices on the network continuously monitor the information on the network, including the rest time. When receiving address data, each device immediately decodes it to determine whether it is its own address. After sending the next character number, there is also a static time of 3.5 characters before sending a new message. The entire message must be sent continuously. If there is a static time of more than 1.5 characters during the sending of frame information, the receiving device refreshes the incomplete information and assumes the next address data.

Address setting

The valid slave device address range is 0-247 (decimal), and the address range of each slave device is 1-247.

The host puts the address of the slave into the address area of ​​the message frame and addresses the slave. When the slave responds, put its own address into the address area of ​​the response message, so that the host can identify the slave address that has responded.

Address 0 is the broadcast address, which can be recognized by all slaves.

Function code setting

Commonly used function codes for Modbus:

The content of the data area

There are 2 hexadecimal data bits in the data area, and the data range is 00-FF (hexadecimal).

The information data sent by the master to the slave device contains the requested action specified in the function code of the master executed by the slave, such as the logical coil address, the number of processing objects, and the actual number of data bytes.

7 Error checking

The CRC field is two bytes, including a 16-bit value, and two 8-bit bytes, which are calculated by the transmission device and added to the message. The receiving device recalculates the receipt

Go to the CRC of the message and compare it with the value in the received CRC field. If the two values ​​are different, there is an error.

Modbus object types

The following is a table of object types provided by a Modbus slave device to a Modbus master device:

Object type Access Size Address Space
Coil Read-write 1 bit 00001 – 09999
Discrete input Read-only 1 bit 10001 – 19999
Input register Read-only 16 bits 30001 – 39999
Holding register Read-write 16 bits 40001 – 49999
Print Email


Leave a Reply

We use cookies to deliver you the best experience. By browsing our website you agree to our use of cookies.