What is MODBUS?

MODBUS is an industrial communication protocol that allows one device to read data from another device or write data to it.

In its simplest form, MODBUS communication can be thought of as one device telling another device: "Send me this data" or "Change this value" .

One of the most important features of MODBUS is that it is not tied to a specific manufacturer or a single device family. This makes it widely used for data exchange between devices from different manufacturers.

MODBUS has an important role in PLCs, energy systems, motor drives, measurement devices, RTUs, SCADA systems and industrial control applications.

Why is MODBUS So Widely Used?

Simple Structure

MODBUS is easy to understand and implement thanks to its relatively simple message structure.

Wide Device Support

A large number of PLCs, RTUs, meters, inverters, energy analyzers and other industrial devices support MODBUS.

Different Communication Media

MODBUS can be used over serial communication such as RS-232 and especially RS-485, or over Ethernet using MODBUS TCP.

Read and Write Operations

Digital and analog data can be read, and control values can be written to devices that support write operations.

Modbus Data Addressing for EOS Software (RH#, RI#, RC#)

In the EOS SCADA Modbus client, a prefix is used at the beginning of the data address to specify the Modbus data area to be read.

RH#REGISTER
RI#REGISTER
RC#COIL

RH# specifies a Modbus Holding Register, RI# specifies an Input Register, and RC# specifies a Coil address.

For example, for Holding Register number 16:

RH#16

For Input Register number 12:

RI#12

For Coil number 5:

RC#5

MODBUS Types

MODBUS has several implementation types designed for different physical and communication environments. The most commonly used types are MODBUS RTU, MODBUS ASCII and MODBUS TCP.

MODBUS RTU

MODBUS RTU is one of the most widely used MODBUS implementations, particularly over RS-485.

  • Can be used with RS-485 and RS-232
  • Uses a binary message structure
  • Uses CRC for error checking
  • Suitable for long-distance communication
  • Widely used in PLCs and field devices

MODBUS ASCII

MODBUS ASCII is a MODBUS implementation in which messages are transmitted using ASCII characters.

  • Uses ASCII characters
  • Messages are easier to read
  • Uses LRC for error checking
  • Creates more communication overhead than RTU

MODBUS TCP

MODBUS TCP enables MODBUS messages to be transmitted over Ethernet and TCP/IP networks.

  • Uses Ethernet
  • Communicates over TCP/IP
  • Uses TCP port 502 by default
  • Widely used in PLC and SCADA systems
  • Does not require RS-485

How Does MODBUS Work?

MODBUS communication is based on one device sending a request and another device responding to that request.

In traditional MODBUS RTU systems, the terms Master and Slave are commonly used. In MODBUS TCP, the terms Client and Server are more commonly used today.

Master / Client

The device that initiates communication and requests data from the other device. For example, a SCADA system can read a temperature value from a PLC.

Slave / Server

The device that responds to a request sent by the Master or Client. For example, an energy analyzer can provide the voltage values it measures through MODBUS.

MODBUS Data Areas

MODBUS data is organized into different data areas. Each area is used for a specific purpose.

Area Data Access Description
Coils 1 bit Read / Write Digital output or control information.
Discrete Inputs 1 bit Read Only Digital input information.
Input Registers 16 bit Read Only Input data such as analog or measurement values.
Holding Registers 16 bit Read / Write Can be used for measurement values, settings, parameters or control values.

MODBUS Addressing

Addressing is one of the topics that causes the most confusion in MODBUS applications. The address shown in a device's technical documentation may not always be represented in the same way within the software.

For example, a Holding Register shown as 40001 in a device manual may be represented using a different starting address depending on the software or driver being used.

Therefore, when establishing communication with a MODBUS device, looking only at the address number is not sufficient. The device manufacturer's register table should be evaluated together with the function code, address, data type, scaling and byte order information.

MODBUS Function Codes

The operation to be performed in MODBUS is specified by a function code. Some of the most commonly encountered function codes are listed below.

Code Operation Description
01 Read Coils Reads the status of coils.
02 Read Discrete Inputs Reads digital inputs.
03 Read Holding Registers Reads Holding Register values.
04 Read Input Registers Reads Input Register values.
05 Write Single Coil Changes the value of a single coil.
06 Write Single Register Writes a value to a single register.
15 Write Multiple Coils Writes values to multiple coils.
16 Write Multiple Registers Writes values to multiple registers.

MODBUS Data Types

MODBUS basically operates using 16-bit Registers. However, real-world applications may use different data types for values such as temperature, pressure, power, energy, or meter readings.

For example, a device may store a 32-bit Float value in two 16-bit Registers. In this case, knowing only the Register address is not enough. It is also necessary to know how the data is encoded.

  • 16-bit Integer
  • Unsigned Integer
  • Signed Integer
  • 32-bit Integer
  • 32-bit Float
  • 64-bit Double
  • Bit fields
  • Scaled values

Byte Order and Word Order

One of the common issues encountered in MODBUS applications is the byte and word ordering of multi-Register values.

Especially for 32-bit and 64-bit values, device manufacturers may use different byte and word ordering schemes. Therefore, even when the same Register values are read, the software may display a completely different number.

For example, 32-bit Float values may use different byte and word orders such as ABCD, CDAB, BADC, or DCBA .

Therefore, when configuring a MODBUS device in a system, the data type and byte/word order must be configured correctly in addition to the Register address.

MODBUS TCP

MODBUS TCP enables the MODBUS protocol to be used over Ethernet and TCP/IP networks. Therefore, it is commonly preferred in systems that use Ethernet infrastructure instead of traditional serial communication.

In MODBUS TCP, devices communicate using IP addresses. The standard MODBUS TCP port is 502.

A SCADA system, PLC, or another client can connect to a MODBUS TCP Server on the network to read Register and Coil values or write values permitted by the device.

Where Is MODBUS Used?

MODBUS has a very wide range of applications. It is particularly common in systems where measurement and control data needs to be transferred between different systems.

Energy Systems

Energy analyzers, electricity meters, power measurement devices, and energy monitoring systems.

Industrial Automation

PLCs, RTUs, inverters, motor drives, control devices, and automation systems.

Measurement Systems

Transmission of temperature, pressure, flow, level, and other process measurements.

SCADA Systems

MODBUS is used in SCADA systems to collect data from field devices and present this data to operators.

MODBUS Communication Problems

Although MODBUS has a relatively simple structure, communication problems can still occur frequently in field applications. Identifying the source of a problem may require checking many parameters, from the physical connection to the Register address.

  • Incorrect device address
  • Incorrect IP address or TCP port
  • Incorrect baud rate
  • Incorrect parity or stop bit configuration
  • Reversed RS-485 A/B connection
  • Incorrect Register address
  • Incorrect function code
  • Incorrect data type
  • Incorrect byte or word order
  • Differences between the addressing used in the device documentation and the software

MODBUS and SCADA

MODBUS is one of the most widely used protocols in SCADA systems for collecting data from field devices.

For example, in a power plant, a SCADA system can collect

  • Voltage
  • Current
  • Active and reactive power
  • Frequency
  • Energy values
  • Device status
  • Alarm information

and many other types of data through MODBUS, and archive this data together with timestamps.

MODBUS Tools

Various tools can be used to test MODBUS communication, control devices, inspect Register values, and troubleshoot communication problems.

In the future, this section will feature MODBUS tools, utility applications, and example software developed or shared by EOS.

MODBUS Tools Coming Soon

Free tools and utility applications developed for MODBUS communication will be shared here.

  • MODBUS RTU testing tools
  • MODBUS TCP testing tools
  • Register read/write tools
  • MODBUS packet analysis tools
  • Communication testing tools
  • Example applications and source code

Summary

MODBUS is an important communication protocol that has been widely used in industrial automation for many years thanks to its simple structure, broad device support, and ability to operate over different communication media.

Supporting MODBUS alone is not enough to ensure successful communication with a device. Device address, function code, Register address, data type, scaling, and byte/word order must also be configured correctly.

Especially in SCADA and data acquisition applications, MODBUS provides a practical and widely adopted solution for reliably collecting data from field devices.