A.2 Architecture and protocol stack
The Modbus protocol follows a master and slave architecture where a master transmits a request to a slave and waits for the response (as shown in Figure A.2-1). This architecture gives the master full control over the flow of information, which has benefits on older multidrop serial networks. Even on modern TCP/IP networks, it gives the master a high degree of control over slave behavior, which is helpful in some designs.
Figure A.2-1: The Master-Slave, Request-Response Relationship of Modbus device
The Modbus protocol allows an easy communication within all types of networks (as shown in Figure A.2-2). Every type of devices (such as PLC, Driver, Motion control, I/O Device, etc.) can use Modbus protocol to initiate a remote operation.
The same communication can be done as well on serial line as on an Ethernet TCP/IP network. Gateways allow a communication between several types of buses or network using the Modbus protocol [i.5].
Figure A.2-2: Modbus Network Architecture
There are many variants of Modbus protocols:
- Modbus RTU - This is used in serial communication & makes use of a compact, binary representation of the data for protocol communication. Modbus RTU is the most common implementation available for Modbus. A Modbus RTU message is transmitted continuously without inter-character hesitations.
- Modbus ASCII - This is used in serial communication and makes use of ASCII characters for protocol communication.
- Modbus TCP/IP or Modbus TCP - This is a Modbus variant used for communications over TCP/IP networks. It does not require a checksum calculation as lower layers already provide checksum protection.
- Modbus over TCP/IP or Modbus over TCP or Modbus RTU/IP - This is a Modbus variant that differs from Modbus TCP in that a checksum is included in the payload as with Modbus RTU.
- Modbus over UDP - Some have experimented with using Modbus over UDP on IP networks, which removes the overheads required for TCP.
- Modbus Plus (Modbus+, MB+ or MBP) - Modbus Plus is proprietary to Schneider Electric® and unlike the other variants, it supports peer-to-peer communications between multiple masters. It requires a dedicated co-processor to handle fast HDLC-like token rotation. It uses twisted pair at 1 Mbit/s and includes transformer isolation at each node, which makes it transition/edge triggered instead of voltage/level triggered.
At present, Modbus TCP is more efficient networking through the use of dedicated connections and identifiers for each request and response. Modbus RTU and Modbus ASCII are older serial ADU formats with the primary difference between the two being that RTU uses a compact binary representation while ASCII sends all requests as streams of ASCII characters.
The Modbus protocol defines a simple Protocol Data Unit (PDU) independent of the underlying communication layers. The mapping of Modbus protocol on specific buses or network can introduce some additional fields on the Application Data Unit (ADU). The Modbus frame is as shown in Figure A.2-3.
Figure A.2-3: Modbus Frame
A Modbus frame or Modbus Application Data Unit (ADU) consists of the following:
- Additional address field: A field containing additional addresses used by the underlying communication protocol. It is 1 byte slave address over serial links (such as RS 232, RS 485). For Modbus TCP, it is called Modbus Application Protocol (MBAP) Header that include transaction identifier, protocol identifier, length and unit identifier.
- Modbus PDU: It is independent of underlying communication layer and consists of two parts: 1) 1-byte Function code to indicate identity of the requested service, 2) Variable length data field containing payload of the requested service. There are three types of Modbus PDUs: Modbus Request, Modbus Response and Modbus Exception.
- An optional error check field. Modbus TCP is not needed.