Modbus
Modbus
Introduction:
Modbus is a widely recognized serial communication
protocol that was developed by Modicon in 1979.
Designed specifically for use with Programmable Logic
Controllers (PLCs), Modbus facilitates the exchange of
data between electronic devices.
@amit_jha
UNDERSTANDING MODBUS
Network Structure:
In a typical Modbus network configuration, there is a
single Modbus Master that can communicate with up to
247 Modbus Slaves. Each slave device is assigned a
unique address ranging from 1 to 247, ensuring clear
identification within the network. This structured
addressing system enables efficient management and
communication among devices.
Master-Slave Communication:
The Modbus Master has the primary role of initiating
requests for data and sending commands to the slaves. In
contrast, the Modbus Slaves respond to these requests,
providing the necessary data back to the Master. This
master-slave relationship forms the backbone of the
Modbus communication process.
@amit_jha
WHAT IS MODBUS USED FOR?
Introduction:
Modbus is an open communication protocol that
manufacturers can use without worrying about expensive
licensing fees. This open-access nature has made Modbus
a widely adopted standard in many industries, becoming
the go-to method for connecting industrial electronic
devices.
@amit_jha
WHAT IS MODBUS USED FOR?
@amit_jha
HOW DOES MODBUS WORK?
Introduction:
Modbus is a widely adopted serial communication protocol
that enables the seamless exchange of data between
electronic devices. Its straightforward design makes it
easy for different devices to communicate with each other,
which is essential for many industrial applications.
Basic Configuration:
In its simplest form, a Modbus setup involves a single serial
cable connecting the serial ports of two devices: a
"master" and a "slave." The master device is responsible
for initiating communication, while the slave responds to
requests from the master. This clear distinction streamlines
the communication process.
@amit_jha
HOW DOES MODBUS WORK?
Data Transmission:
The foundation of Modbus communication lies in the
transfer of data represented in binary code, which consists
of a sequence of ones and zeros, known as bits. These bits
are transmitted using variations in voltage levels.
Specifically, a binary zero is represented by a positive
voltage, while a binary one is indicated by a negative
voltage. This encoding method enables clear and efficient
data transfer.
Efficiency of Communication:
Modbus is designed for rapid transmission of bits, making
it an efficient choice for real-time communications. A
common transmission speed in Modbus systems is 9600
baud, which refers to the number of bits sent every
second. This speed is effective for many industrial
applications, allowing devices to communicate quickly and
reliably.
@amit_jha
MASTER AND SLAVE IN MODBUS
Introduction:
In the Modbus communication framework, a master-slave
architecture is employed to facilitate effective data
exchange between devices. This structure is essential for
maintaining organized communication within industrial
automation systems.
Master Device:
The master device is usually a controller, plays a pivotal role
in initiating requests for data or commands. Master sends a
request to a slave device, which is typically a field device or
sensor. This request contains critical information needed for
successful communication, including:
Slave Address: A unique identifier for each slave device
on the network, which helps the master pinpoint the
exact device it wants to communicate with.
Function Code: This indicates the specific type of
operation the master wishes to perform, such as reading
data or writing new values.
Data Parameters: These parameters provide additional
details necessary to execute the command.
@amit_jha
MASTER AND SLAVE IN MODBUS
Slave Device:
Upon receiving the master’s request, the slave device
processes the command based on the provided
information. After executing the requested action, then it
transmits the data or acknowledgment back to the master.
This process ensures that the master is kept informed
about the status of various devices in the system.
Bidirectional Communication:
The master-slave communication in Modbus supports
bidirectional interaction, enabling real-time monitoring and
control of industrial processes. This capability is crucial for
efficient system operation, allowing adjustments to be
made based on feedback from slave devices.
@amit_jha
DATA STORAGE IN MODBUS
Introduction:
In Standard Modbus, data is structured within the slave
device in four distinct tables. These tables are divided into
two categories: on/off discrete values (coils) and numerical
values (registers). Additionally, each category has a read-
only table and a read-write table, totaling four tables.
Capacity of Tables:
Each of these tables can hold up to 9999 values, making
them capable of managing substantial amounts of
information.
Addressing Scheme:
For both coils and registers, data addresses range from
0000 to 270E. This addressing structure allows both coils,
which represent 1-bit on/off discrete values, and registers,
designed to store numerical data, to be accessed
efficiently.
@amit_jha
DATA STORAGE IN MODBUS
@amit_jha
UNDERSTANDING THE SLAVE ID
Introduction:
In Modbus communication, each slave device within the
network is assigned a unique identifier known as the slave
ID or unit address. This ID ranges from 1 to 247, serving a
critical role in the identification of the intended recipient for
each message transmitted across the network.
@amit_jha
FUNCTION CODES IN MODBUS
Introduction:
In the Modbus protocol, the function code plays a crucial
role in defining the actions the master device requests
from the slave device. This numerical code informs the
slave about the specific operation it needs to perform,
making it vital for effective communication within a
Modbus network.
@amit_jha
FUNCTION CODES IN MODBUS
@amit_jha
CRC IN MODBUS
Introduction:
CRC, or Cyclic Redundancy Check, is a crucial method
used in Modbus and many other communication protocols
for detecting errors in transmitted data. By implementing
CRC, Modbus ensures that the integrity of the information
exchanged between devices is maintained.
@amit_jha
CRC FUNCTIONS IN MODBUS
@amit_jha
CRC FUNCTIONS IN MODBUS
4. Error Detection:
If the CRC value calculated by the receiver does not match
the one included in the message, this discrepancy
indicates a potential error in the transmission. In such
cases, the receiving device can request that the sender
resend the message, thereby ensuring that erroneous data
is not processed.
@amit_jha