MODBUS

MODBUS

Modbus – The Communication Protocol for Industry

In modern companies, everything runs via communication. However, this not only concerns communication on a human level – nothing functions without communication between individual computers and other technological systems. There are diverse communication protocols for exchanges between different devices. The most frequently used protocol is Modbus. The inventor is Gould-Modicon which, in the year 1979 searched for a way by which computers could communicate with PLC systems. Since 2007, Modbus TCP (a special version of the protocol) has belonged to the industrial standard ICE 61158. Accordingly, there is almost no branch of industry that does not work with the Modbus protocol.

How does the Protocol work?

In principle, the function of the protocol is simple. The information protocol ensures that a master device (in most cases a computer) and one or more slave devices are connected to each other. This way for example, different measurement devices can be controlled by a computer and/or can transfer data back to a computer. With this, the data transfer functions via three different paths ASCII, RTU and TCP, each of which are suited to different purposes. The transmission systems can be either Ethernet or the slightly older variant of the serial connection.

  • ASCII – This mode is especially characterized by the fact that its data is sent in ASCII (instead of the binary code) so that they can be read by humans. This is considerably more difficult to implement than when binary-encrypted codes are transmitted. The structure of the codes is always the same. The message starts with a colon, followed by the address of the receiver (in ASCII). Then the command to be executed is represented, followed by the message itself. This can have a variable length. A so-called LRC command is attached for error checking. Every ASCII message ends with the character CRLF.
  • RTU – The so-called remote terminal unit mode transmits binary codes as opposed to the ASCII mode, which cannot be read easily by humans. However, this method has a considerably better data throughput. Every Modbus RTU code starts with a long pause that is at least 3.5 characters long, but varies with the transmission speed. This is then followed by the address of the receiver, which is represented in 8 bits, as well as the function code which also is composed of 8 bits. In the case of correct transmission, the fields are sent from the master to the slave and then sent back again unchanged. In the case of errors, code changes occur. The following data field exists so that the slave can send the measured data to the master. The entire message is checked via CRC. The end of each RTU message is characterized by a further waiting time of at least 3.5 characters. In order to completely receive the requested information, generally no interruptions should occur in the information flow. When the data flow is interrupted, it is advisable not to depend on the message in most cases, as it may be incomplete. The RTU Modbus transmits its data via a serial interface.
  • TCP – This mode is especially intended for the Ethernet. It is very similar to the RTU mode, as it also transmits in binary codes, but no control bytes have to be calculated for the TCP Modbus. As such, TCP drivers can be handled and implemented more easily. However, the structure of the protocol differs a little from the structure of the RTU code. At the start of each TCP message, there is the transaction number which is 2 bytes. This is followed by the protocol character. This always has the same structure: 0x0000. Then comes the number of the bytes that are still to follow as well as the address and the function field. The data which always have a different size depending on the length of the message, come at the end of the message. Generally, the TCP port 502 is reserved for the Modbus TCP.

Modbus, a universal System

Modbus has become nearly indispensable for automation technology. In particular, transmission via Ethernet (i.e. the TCP protocol) is considered a de-facto standard. The Internet also is based on this client-server structure. The practical advantage of this method is just that the various Modbus variants all use a common application protocol which essentially facilitates the communication processes in industry. This technology guarantees a universal protocol for the communication of automation technology devices. The transmission medium that is used does not matter with this. The application protocol functions completely independently and as such, it can be used in many ways. PLCs are used in very diverse areas of industry, large and small. A uniform communication pathway is therefore essential. The Modbus sends an inquiry from the master to the slave / slaves and as such, can transmit data quickly and securely in a uniform way. Modern technologies also make it possible to combine the various transmission types with each other. As such, for example, it is possible to integrate devices with serial interfaces by using corresponding protocol converters in systems that mainly run via the Internet, i.e. TCP.