Modbus TCP/IP Server Read
Server device reads data from server device register over TCP/IP network
Since R2022a
Add-On Required: This feature requires the MATLAB Coder Support Package for NVIDIA Jetson and NVIDIA DRIVE Platforms add-on.
Libraries:
NVIDIA Jetson and NVIDIA DRIVE /
Network
Description
In the Modbus TCP/IP Server Read block, the server device reads data from its registers. The server can read data from only one register per read operation.
MATLAB® Coder™ Support Package for NVIDIA® Jetson™ and NVIDIA DRIVE® Platforms supports the Modbus® communication protocol over the TCP/IP network on Jetson platforms.
Note
The Modbus TCP/IP Server Read block is not supported on NVIDIA DRIVE platforms.
The server can perform read and write operation on these server register(s).
Register Type | Register Size |
---|---|
Coil | 1-bit |
Discrete Input | 1-bit |
Holding Register | 16-bit |
Input Register | 16-bit |
The server can perform either a read or a write operation on its registers.
Examples
MODBUS TCP/IP Communication Between Client and Server Devices Using NVIDIA Jetson TX2 Hardware
Use the MATLAB® Coder™ Support Package for NVIDIA® Jetson® and NVIDIA DRIVE® Platforms to implement MODBUS® TCP/IP communication between MODBUS client and server devices. It also shows how to communicate between the two devices in four modes of operation, Client Read, Client Write, Server Read, and Server Write.
Ports
Output
Data — Output data
scalar
The block outputs the data read by the server device from its register as a 1-bit scalar.
If you select the Coil or Discrete Input read operations, the server reads its registers as a 1-bit read operation. The block outputs the read data as Boolean data.
If you select the Holding Register or Input Register read operations, the server reads its registers as a 16-bit read operation. The block outputs the read data as
uint16
data.
Data Types: Boolean
| uint16
Status — Status of read operation
0
| 1
The block outputs the status of the server read operation on the server register.
0
: Indicates an unsuccessful read operation, which means that the data received on the data port is invalid.1
: Indicates a successful read operation, which means that the data received on the data port is valid.
Data Types: uint8
Parameters
Function — Type of read operation
Read Coil
(default) | Read Discrete Input
| Read Holding Register
| Read Input Register
Select the type of read operation you want to perform on the server register. Specify one of the following:
Value | Description |
---|---|
Read Coil | Read data from the coil register address specified in the Coil Address parameter. |
Read Discrete Input | Read data from the discrete input register address specified in the Discrete Input Address parameter. |
Read Holding Register | Read data from the holding register address specified in the Holding Register Address parameter. |
Read Input Register | Read data from the input register address specified in the Input Register Address parameter. |
Programmatic Use
Block Parameter:
Function
|
Type: character vector |
Values:
'Read Coil' | 'Read Discrete Input' |
'Read Holding Register' | 'Read Input
Register' |
Default:
'Read Coil' |
Coil Address — Address of coil register
0
(default) | scalar
To notify the server to read data from a specific coil register, specify the coil
register address in this parameter. For example, for the server to read data from the
coil register with the address 10
, enter
10
.
Dependencies
To enable this parameter, set Function to Read
Coil
.
Programmatic Use
Block Parameter:
CoilAddress
|
Type: character vector |
Values:
'0' | scalar |
Default:
'0' |
Discrete Input Address — Address of discrete input register
0
(default) | scalar
To notify the server to read data from a specific discrete input register, specify
the discrete input register address in this parameter. For example, for the server to
read data from the discrete input register with the address 80
, enter
80
.
Dependencies
To enable this parameter, set Function to Read
Discrete Input
.
Programmatic Use
Block Parameter:
DiscreteInputAddress
|
Type: character vector |
Values:
'0' | scalar |
Default:
'0' |
Holding Register Address — Address of holding register
0
(default) | scalar
To notify the server to read data from a specific holding register, specify the
holding register address in this parameter. For example, for the server to read data
from the holding register with the address 37
, enter
37
.
Dependencies
To enable this parameter, set Function to Read
Holding Register
.
Programmatic Use
Block Parameter:
HoldingRegisterAddress
|
Type: character vector |
Values:
'0' | scalar |
Default:
'0' |
Input Register Address — Address of input register
0
(default) | scalar
To notify the server to read data from a specific input register, specify the input
register address in this parameter. For example, for the server to read data from the
input register with the address 25
, enter
25
.
Dependencies
To enable this parameter, set Function to Read
Input Register
.
Programmatic Use
Block Parameter:
InputRegisterAddress
|
Type: character vector |
Values:
'0' | scalar |
Default:
'0' |
Sample time — Time interval at which server reads data
0.1
(default) | scalar
Enter the time interval (in seconds) at which the server reads data from its register.
Programmatic Use
Block Parameter:
SampleTime
|
Type: character vector |
Values: scalar | vector |
Default:
'0.1'
|
Version History
Introduced in R2022a
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)