The Modbus protocol is a communication protocol based on a master/slave or client/server architecture. It was introduced in 1979 by Gould-Modicon for communication with its programmable logic controllers. In industry, Modbus has become a de facto standard as it is an open protocol. Since 2007, the Modbus TCP version has been part of the IEC 61158 standard. [Wikipedia]

As the following diagram shows, Modbus allows communication over different networks:

Modbus distinguishes the following three modes of operation:

  1. Modbus ASCII:In Modbus ASCII, not a binary sequence but ASCII code is transmitted. This makes it directly human-readable, but data throughput is lower compared to RTU.

  2. **Modbus RTU:**Remote Terminal Unit (RTU) transmits data in binary form. This ensures good data throughput, but the data cannot be directly interpreted by humans and must first be converted into a readable format.

  3. **Modbus TCP:**Modbus/TCP is very similar to RTU, but TCP/IP packets are used to transmit the data. TCP port 502 is reserved for Modbus/TCP. [Wikipedia]

With Mondus it is a PDU (Protocol Data Unit) or Service Data Unit (SDU) that contains the complete set of data and management information independently of the underlying network layer. Within the OSI model, the protocol is located at layer 7. By mapping Modbus onto a specific bus or network, additional fields can be added. This extension is labeled as ADU in the illustration.

The size of a frame is as follows:

The Modbus data model distinguishes between four data types or register types.

The following list provides an overview of the PDU function codes:

For more information on the individual register types, I refer to the specification.

The following illustration demonstrates error-free client/server communication:

In the case of an error, the communication looks as follows:

Each bus participant has a unique address. Each participant may send messages on the bus. In practice, communication is initiated by the master and an addressed slave responds.

Example:

To illustrate communication between client (master) and server (slave), I use the following applications:

The illustration shows how a slave provides a value (24) within the ‘holding’ register (register 1 of 65k).

The master connects via TCP port 502 to the slave and makes a ‘holding’ register ‘1’ query and receives the value 24, e.g. 24 degrees Celsius.