Using MODBUS For Process
Using MODBUS For Process
Using MODBUS For Process
MODBUS is the most popular industrial protocol being used today, for good reasons. It is simple, inexpensive, universal and easy to use. Even though MODBUS has been around since the past centurynearly 30 years almost all major industrial instrumentation and automation equipment vendors continue to support it in new products. Although new analyzers, flowmeters and PLCs may have a wireless, Ethernet or fieldbus interface, MODBUS is still the protocol that most vendors choose to implement in new and old devices. Another advantage of MODBUS is that it can run over virtually all communication media, including twisted pair wires, wireless, fiber optics, Ethernet, telephone modems, cell phones and microwave. This means that a MODBUS connection can be established in a new or existing plant fairly easily. In fact, one growing application for MODBUS is providing digital communications in older plants, using existing twisted pair wiring. In this white paper, well examine how MODBUS works and look at a few clever ways that MODBUS can be used in new and legacy plants.
Figure 1. A MODBUS RTU network consists of one master, such as a PLC or DCS, and up to 247 slave devices connected in a multi-drop configuration.
NET Concentrator System Station #1 NET Concentrator System Station #2 4-20mA Signals
4-20mA Signals
Process Measurements
Process Measurements
What is MODBUS?
MODBUS was developed by Modicon (now Schneider Electric) in 1979 as a means for communicating with many devices over a single twisted pair wire. The original scheme ran over RS232, but was adapted to run on RS485 to gain faster speed, longer distances and a true multi-drop network. MODBUS quickly became a de facto standard in the automation industry, and Modicon released it to the public as a royalty free protocol. Today, MODBUS-IDA (www.MODBUS.org), the largest organized group of MODBUS users and vendors, continues to support the MODBUS protocol worldwide. MODBUS is a master-slave system, where the master communicates with one or multiple slaves. The master typically is a PLC (Programmable Logic Controller), PC, DCS (Distributed Control System) or RTU (Remote Terminal Unit). MODBUS RTU slaves are often field devices, all of which connect to the network in a multidrop configuration, Figure 1. When a MODBUS RTU master wants information from a device, the master sends a message that contains the devices address, data it wants, and a checksum for error detection. Every other device on the network sees the message, but only the device that is addressed responds.
Slave devices on MODBUS networks cannot initiate communication; they can only respond. In other words, they speak only when spoken to. Some manufacturers are developing hybrid devices that act as MODBUS slaves, but also have write capability, thus making them pseudo-Masters at times. The three most common MODBUS versions used today are: MODBUS ASCII MODBUS RTU MODBUS/TCP
All MODBUS messages are sent in the same format. The only difference among the three MODBUS types is in how the messages are coded. In MODBUS ASCII, all messages are coded in hexadecimal, using 4-bit ASCII characters. For every byte of information, two communication bytes are needed, twice as many as with MODBUS RTU or MODBUS/TCP. Therefore, MODBUS ASCII is the slowest of the three protocols, but is suitable when telephone modem or radio (RF) links are used. This is because ASCII uses characters to delimit a message. Because of this delimiting of the message, any delays in the transmission medium will not cause the message to be misinterpreted by the receiving device. This can be important when dealing with slow modems, cell phones, noisy connections, or other difficult transmission mediums.
The Device Address is a number from 0 to 247. Messages sent to address 0 (broadcast messages) can be accepted by all slaves, but numbers 1-247 are addresses of specific devices. With the exception of broadcast messages, a slave device always responds to a MODBUS message so the master knows the message was received.
Figure 2. Function Codes.
Command 01 02 03 04 05 06 07 08 . . xx
Function Code Read Coils Read Discrete Inputs Read Holding Registers Read Input Registers Write Single Coil Write Single Register Read Exception Status Diagnostics
Type Read or Write Read Only Read Only Read or Write Coils
30001-39999 40001-49999
Figure 4. Home Run Wiring vs MODBUS. In most plants, field instruments connect to the control system with individual home run twisted pairs (below). When the instruments are wired into a distributed I/O system, such as the NCS from Moore Industries (center), more devices can be added, but only a single twisted pair is needed to transmit all the data to the MODBUS master. Multiple NCS systems can be networked (bottom) over the same MODBUS network, so the entire plant can be converted from home run wiring to MODBUS.
Figure 5. Peer-to-Peer Wiring. In some cases, the control system is not able to deal with a MODBUS signal. In that case, a peer-topeer solution with two NCS systems simply replaces all the home run wiring with a single MODBUS cable. Analog outputs from the control room NCS are then wired directly into the host systems I/O card.
4-20mA
MODBUS RTU RS485 Communication Link
Module Number
DCS
I/O Rack
With a HART interface module that supports MODBUS RTU communication, all the HART data can be brought to the control system simply and cost effectively (Figure 6). The HIM is a smart device that acts like HART master on the front end and MODBUS RTU slave on the back end. The HIM extracts all of the digital HART data from the 4-20mA signal without placing a burden on the loop. It then provides a display, three 4-20mA signals, two relays and an optional dual MODBUS RTU output. When the MODBUS option is utilized, the HART data is digitally mapped to the HIMs MODBUS memory map where it can then be polled by a PLC or DCS that is acting as the MODBUS RTU Master. By multi-dropping various HIM devices via RS485, this essentially becomes a scaleddown asset management system for a fraction of the cost.
Wireless MODBUS
A MODBUS network can be set up fairly easily to work over a wireless link (Figure 7). Essentially, all the wireless link does is replace the twisted pair cables with a transmitter/receiver at each end of the network. Many wireless radio manufacturers support the MODBUS protocol. However, due to some encryption schemes and time delays that radios and modems use, it is important to consult with your wireless vendor before making the assumption that it is supported.
radio site surveys that include signal strength and spectrum noise analysis can often avoid many communication hiccups.
Module Number
MODBUS
Module Number
MODBUS
Packet. Assuming that the packet has not been damaged or corrupted, it will then be sent to the destined slave. The slave will respond back to the Master and the process starts again. Sometimes it is important to pay special attention to a MODBUS communication parameter called timeout. Timeout is the amount of time that the MODBUS master will wait for a response from a slave before attempting a re-transmission. Depending on how well the radio is communicating, packets can be delayed, causing an unnecessary amount of retries and re-transmits. With todays FHSS (Frequency Hopping Spread Spectrum) radios, most of these parameters can be massaged for efficient transfer of MODBUS packets. However, proper