Tran Thien Thuan - SCADA
Tran Thien Thuan - SCADA
Then we open both Modbus Pool and Modbus Slave and setting the connection to
Serial Port, then we set Serials Setting in Modbus Pool COM 10 to COM 7, for the
Modbus Slave we also setting COM 7 to COM 10 in the Serials Setting.
At the start, both the Slave ID and Master ID values in Modbus Slave and Modbus
Poll are set to 0.
We set the function at both Modbus Slave and Modbus Pool to Read Coils (0x).
The Modbus Read Coils (0x) function is one of the basic operations in the Modbus
protocol, used to read the status of coils. Coils are usually digital outputs that can
be either on or off (0 or 1) and often represent devices like relays or LEDs. When
using this function, the Master device requests the Slave device to provide the
current status of one or more coils. Specifically, Function Code 0x01 (Read Coils)
is used to ask a Slave to return the state of coils from a starting address for a
specified number of coils. The coils are addressed from 0 to 65,535. In response,
the Slave device returns a series of bits, with each bit representing the status of one
coil—1 if the coil is on and 0 if it’s off. For instance, if the request is to read coils
0 through 7 and their current states are 10101011, the Slave will return a byte with
that bit pattern, indicating each coil's status. This function is valuable for
monitoring on/off device states within industrial control systems.
3.Input startus
Read Discrete Inputs, is used to read the status of digital input signals from a Slave
device. Discrete inputs are signals with only two possible states, typically
represented as on or off (0 or 1), and are often used to receive status information
from sensors or switches. When the Master requests to read discrete inputs, it uses
Function Code 0x02, with the address range for discrete inputs typically spanning
from 10001 to 165536 (referred to as 1x to distinguish it from other modes like 0x
or 3x). The Slave responds with a sequence of bits, each representing the state of
one discrete input (1 for on, 0 for off). This function is useful in monitoring sensor
or switch states within industrial environments where input statuses need to be
checked periodically or upon change.
4.Read Holding Registers
Read Holding Registers in Modbus is designed for reading values from holding
registers, which are writable memory locations in the Slave device that store
various types of data, such as analog input or output values, configurations, or
counters. The Master uses Function Code 0x03 to request values from holding
registers, which typically have an address range from 30001 to 365536, referenced
as 3x. The Slave responds with the data in the specified register range. This
function is essential for reading important device data, settings, or parameters, and
is widely used in applications needing continuous data collection.
II.Modbus TCP/IP
1.Difinition
Modbus TCP/IP is a variation of the Modbus protocol that allows communication
over TCP/IP networks, such as Ethernet, enabling devices to connect over local
networks or even the internet. In Modbus TCP/IP, the standard Modbus message
structure is encapsulated within TCP packets, facilitating data transfer between a
Master and multiple Slave devices over a more flexible and widely supported
infrastructure compared to serial communication. Each device is identified by an
IP address and port number, with the default port for Modbus TCP/IP being 502,
allowing it to integrate seamlessly with other networked systems in industrial and
building automation environments.
In a Modbus TCP/IP network, the Master, often a PC or PLC, sends requests to
one or more Slave devices by specifying the IP address of the desired device.
Modbus TCP/IP operates on a client-server model, where the Master functions as
the client and the Slaves as servers, responding to requests to read or write data.
Because the protocol operates over TCP, it provides a connection-oriented and
error-checked communication channel, which improves reliability and allows
multiple Masters to communicate with the same Slave if needed. Each message
includes a header called the MBAP (Modbus Application Protocol) header, which
replaces the traditional CRC found in RTU since TCP handles error-checking.
Modbus TCP/IP is widely used in industrial settings requiring connectivity over
modern networks, such as factory automation, energy management, and process
control, enabling data acquisition, monitoring, and control from remote or
distributed locations. Its compatibility with Ethernet and TCP/IP networks makes it
an attractive choice for applications requiring highspeed communication, broader
device support, and integration with IT systems.
2. connection
3.Input status
4.Read Holding Registers
5.Read Input Registers