Introduction to Modbus Protocol

Introduction to Modbus Protocol

Modbus is a serial communication protocol that was published by Modicon (now Schneider Electric) in 1979 for communication with programmable logic controllers (PLCs). Modbus has become the de facto industry standard for communication protocols in the industrial sector and is now a common method for connecting industrial electronic devices. The main reasons for the widespread use of Modbus compared to other communication protocols include:

  1. It is publicly available and has no copyright requirements.

  2. It is easy to deploy and maintain.

  3. There are few restrictions for vendors to modify local bits or bytes.

Modbus allows multiple (approximately 240) devices to connect and communicate on the same network. For example, a device that measures temperature and humidity can send results to a computer. In data acquisition and supervisory control and data acquisition (SCADA) systems, Modbus is commonly used to connect monitoring computers and remote terminal units (RTUs).

Protocol Versions

The Modbus protocol currently exists in versions for serial, Ethernet, and other networks that support Internet protocols.Most Modbus devices communicate through the EIA-485 physical layer.For serial connections, there are two variants that differ slightly in numerical data representation and protocol details. Modbus RTU is a compact format that uses binary representation for data, while Modbus ASCII is a human-readable, verbose representation. Both variants use serial communication. The RTU format includes a cyclic redundancy check (CRC) checksum for subsequent commands/data, while the ASCII format uses a longitudinal redundancy check (LRC) checksum. Nodes configured as RTU variants cannot communicate with nodes set as ASCII variants, and vice versa.For connections over TCP/IP (such as Ethernet), there are multiple Modbus/TCP variants, which do not require checksum calculations.All three of these communication protocols have the same data model and function calls; only the encapsulation method differs.Modbus has an extended version called Modbus Plus (Modbus+ or MB+), but this protocol is proprietary to Modicon and differs from Modbus. It requires a dedicated coprocessor to handle high-speed token rotation similar to HDLC. It uses twisted pair wiring at 1Mbit/s, and each node has isolation devices, employing a conversion/edge-triggered rather than voltage/level-triggered approach. Connecting Modbus Plus to a computer requires a special interface, typically a card that supports ISA (SA85), PCI, or PCMCIA buses.

Communication and Devices

The Modbus protocol operates on a master/slave architecture. One node is the master node, while the other nodes participating in communication using the Modbus protocol are slave nodes. Each slave device has a unique address. In serial and MB+ networks, only the node designated as the master can initiate a command (on Ethernet, any device can send a Modbus command, but typically only one master device leads the instructions).A Modbus command includes the Modbus address of the device intended to execute it. All devices receive the command, but only the device at the specified address will execute and respond to the instruction (address 0 is an exception; commands addressed to 0 are broadcast commands, and all devices receiving the command will execute it but not respond). All Modbus commands include a checksum to ensure that the received command has not been corrupted. Basic Modbus commands can instruct an RTU to change a value in its registers, control or read an I/O port, and direct the device to return one or more pieces of data from its registers.Many modems and gateways support the Modbus protocol because it is simple and easy to replicate. Some of them are specifically designed for this protocol. There are various implementations using wired, wireless communication, and even SMS and GPRS. However, designers need to overcome issues such as high latency and timing problems.

Implementation

Almost all implementations are some variant of the official standard. Different vendor devices may not communicate correctly with each other. Some major variations include:

  • Data types

  • IEEE standard floating-point numbers

  • 32-bit integers

  • 8-bit data

  • Mixed data types

  • Bit fields in integers

  • Multipliers to change data to/from integer: 10, 100, 1000, 256 …

  • Protocol extensions

  • 16-bit slave addresses

  • 32-bit data sizes (1 address = return 32-bit data)

  • Word-swapped data

Limitations

  • Modbus was developed in the late 1970s for communication with programmable logic controllers, and the limited data types were understandable by PLCs at that time; large binary object data is not supported.
  • There is no standard method for nodes to find descriptive information about data objects; for example, determining whether a register data represents a temperature between 30-175 degrees.
  • Since Modbus is a master/slave protocol, there is no way to request devices to “report exceptions” (except for open-mbus built on Ethernet TCP/IP) – the master node must poll each node device in a loop and look for changes in the data. This method consumes bandwidth and network time in applications where bandwidth may be precious, such as on low-rate wireless links.
  • Modbus can only handle 247 addresses on a data link, limiting the number of devices that can connect to the master station (again, Ethernet TCP/IP is an exception).
  • Modbus transmission buffers data between remote communication devices, imposing a requirement for continuous communication, which avoids issues with buffer gaps during transmission.
  • The Modbus protocol has no security against unauthorized commands or data interception.
  • EndSource: Reprinted from Wikipedia: Bai Shun NET,This article is a network reprint, and the copyright belongs to the original author. However, due to numerous reprints, it is impossible to confirm the true original author, so only the source of the reprint is indicated. If the videos, images, or text used in this article involve copyright issues, please inform us immediately, and we will confirm the copyright based on the proof materials you provide and pay remuneration according to national standards or delete the content immediately! The content of this article reflects the views of the original author and does not represent the views of this public account or its responsibility for its authenticity.

    Scan the QR code below

    To help you become an excellent electrical engineer

    Teacher Zuo: 18073180632 (same as WeChat)
    

    Leave a Comment