Common Industrial Protocol - Basic Introduction and Application of MODBUS
Modbus (Modicon Communication Protocol) is a serial communication protocol used in the field of industrial automation. Originally developed by Modicon (now part of Schneider Electric) in 1979 for use with its PLC (Programmable Logic Controller), it has now become an industry standard for communication protocols in the industrial sector and is widely used.
The Modbus protocol is a commonly used connection method between industrial electronic devices, especially in monitoring and control systems. PLCs, DCSs, smart instruments, and others all use the Modbus protocol as their standard communication protocol. With it, control devices produced by different manufacturers can be connected into an industrial network for centralized monitoring.

The Modbus protocol employs a master-slave communication technology, involving communication between a master station (Master) and multiple slave stations (Slave), where the master device actively queries and operates the slave devices. Generally, we refer to the protocol used by the master control device as Modbus Master, and the protocol used by the slave devices as Modbus Slave.

It conducts data transmission through serial lines between devices. The simplest setup involves connecting the serial ports on two devices (a master device and a slave device) using a serial cable. Data is sent in a sequence of 1s and 0s, known as bits. Each bit is sent as a voltage. 0 is sent as a positive voltage, while 1 is sent as a negative voltage. The master station sends requests to the slave station, which then responds to these requests.
Through the Modbus protocol, controllers can communicate with each other or with other devices via a network (such as Ethernet). Typical master devices include industrial computers and industrial controllers, while typical slave devices include PLC (Programmable Logic Controller) and so on.

Modbus is an application layer message transmission protocol on the seventh layer of the OSI model, providing client/server communication between devices connected to different types of buses or networks. The Modbus application layer protocol and service specifications mainly include two categories: one is Modbus over serial links (Modbus serial links are based on TIA/EIA standards: 232-F and 485-A), and the other is Modbus over TCP/IP (Modbus TCP/IP is based on IETF standards: RFC793 and RFC791). The schematic diagram of the Modbus communication stack is shown below:

Modbus is also an open protocol that can operate on different physical layers. Its communication physical interface can be selected from serial ports (including RS-232 and RS-485) or Ethernet ports. The most commonly used Modbus protocols include the following four types: Modbus ASCII, Modbus RTU, Modbus Plus, and Modbus TCP. In serial port mode, the commonly used frame formats are RTU (Remote Terminal Unit) and ASCII. In Ethernet mode, the Modbus TCP protocol is usually used. The Modbus protocol is essentially consistent with the protocols we usually customize, which is a data transmission format consisting of a start frame, data frame, check frame, etc., except that the Modbus protocol is more standardized.
The Modbus protocol defines a simple Protocol Data Unit (PDU) that is independent of the underlying communication layer. The Modbus protocol mapping on a specific bus or network can introduce some additional fields on the Application Data Unit (ADU). The general Modbus frame protocol is shown in the figure below:

Specific analysis is as follows:
1) Address field: address information of the child node.
2) Function code: This indicates the action that the server is to perform. The valid code range is decimal 1-255 (128-255 are reserved for abnormal responses). When sending a message from the client to the server device, the function code field informs the server of the operation to be performed.
3) Data: The content of the transmitted data, in a certain request, the data may not occur (length 0), in which case the server does not require any additional information, and the function code only specifies the operation.
4) Error checking: Verifying whether the received and sent data are correct.
If there are no errors related to the requested Modbus function in a correctly received Modbus ADU, the response data field from the server to the client includes the requested data. If there are errors related to the requested Modbus function, the field includes an exception code, which the server application can use to determine the next operation to perform.
In summary, the simplicity, flexibility, and ease of use of the Modbus protocol make it one of the most common communication protocols in industrial automation. Due to its openness, the Modbus protocol is widely supported, enabling devices from different manufacturers to easily communicate within the same network.










