Modbus Protocol Background
Modbus is a serial communication protocol developed by Modicon originally for communication in their line of programmable Logic Controllers. The protocol was published and released for royalty free industry use as a standard communication path between two or more instruments, transducers and controllers and over the years has become a de facto industry standard. Modbus is now the most commonly used protocol for communications between a large offering of industrial instrumentation ranging from ‘smart’ transducers to data acquisition systems to control systems… hence the initiative to incorporate Modbus option into the Logic Beach IntelliLogger™data logging, reporting and alarming instrument family.
Modbus communication is quite simple in basic concept, a feature which led to its early and widespread adoptance by industry.
Modbus Master and Slave Concept
Modbus communication can be implemented as a communications scheme between two or more devices making up a network. In a Modbus network, communications will be between a Master and a Slave device (different terms are used for Modbus TCP but that will be explained later). Using special commands, the Master device interrogates the Slave device over the network periodically for information.
An example of a simple Modbus network is an IntelliLogger (being the Master) and a Modbus enabled pressure transducer being the Slave device. In normal operation, the IntelliLogger will interrogate the transducer periodically for its current pressure reading. The IntelliLogger will then use this pressure information as necessary… for example, logging it to local memory, turning on an alarm output, embedding into a Web page, etc.
Additionally, in many applications, the Master device can write to the Slave device, changing its internal settings and operation. For example, the pressure transducer above may have a local alarm output feature. The IntelliLogger could then read the pressure from the pressure transducer and if an alarm condition is detected, the transducer alarm could be turned on by the IntelliLogger by writing an alarm control value to the transducer.
Modbus Registers Concept
Modbus devices contain internal memory locations referred to as ‘registers’. The values stored in these Registers may be updated by the device itself in normal operation. In the pressure transducer example, the pressure transducer is periodically sampling the media pressure. The last sensed pressure value is stored in the ‘Last Pressure’ register. The IntelliLogger can then read this ‘Last Pressure’ register over the Modbus network and retrieve the last pressure read by the pressure transducer.
The alarm output feature in the pressure transducer mentioned above would also have a register associated with it. The IntelliLogger could control the alarm output in the pressure transducer by writing to the Alarm Output register with a On or Off command (e.g. a 1 or a 0).
In reality, Modbus devices normally have registers that are Read Only and Read/Write capable. In the pressure transducer mentioned above, there might be 10 or more Modbus registers containing calibration constants, temperature compensation values, sampling rate settings, last temperature, last pressure, averaged pressures, etc. More complex Modbus devices may have hundreds of registers.
Modbus Device Address Concept
As multiple devices can be connected in a Modbus network, each device is assigned a unique Modbus address. In this way, communications between devices can be directed to specific devices and other devices on the network can ignore the messages. Special ‘broadcast’ type commands do exist whereby a message is broadcast to all devices on the network for action.
Modbus Communication Serial Links
Most Modbus device networks are implemented with communication via a 2 or 4-wire RS-485 serial link. Some devices have Modbus implemented on an RS-232 link however RS-232 does not readily allow for more than two devices to be interconnected.
More recently, Modbus has been implemented over Ethernet allowing for multiple devices in a network using ubiquitous Ethernet network components (routers, switches, cellular, etc) that make up LAN’s and even over the Internet. Modbus over Ethernet is referred to as Modbus TCP/IP.
Modbus RTU and Modbus ASCII
Excluding Modbus TCP/IP, two variants of Modbus exist that are used in non-TCP/IP networks, Modbus RTU and Modbus ASCII. The difference between these protocols is the format used in the commands. Modbus RTU uses binary characters and Modbus ASCII uses ASCII characters. Modbus RTU is most common and is supported by the IntelliLogger in both the Modbus RTU Master and Modbus RTU Slave options.
Modbus TCP/IP (commonly referred to as Modbus TCP) uses the same Modbus commands however the commands are encapsulated within TCP/IP packets to allow them to move on LAN’s and over the Internet.
Rather than Master and Slave terminology, communicating devices on a Modbus TCP/IP network are referred to as Server and Client. In the above example… the IntelliLogger would be the Client device and the pressure transducer would be the Server (it ‘serves’ its pressure values to the Client). The IntelliLogger Modbus TCP option supports use of the IntelliLogger as a Modbus Server… allowing other network Client devices to garner register values from the IntelliLogger.