How to specify serverID when using modbus for Raspberry Pi?

2 ビュー (過去 30 日間)
KristianT
KristianT 2023 年 10 月 2 日
回答済み: Rijuta 2023 年 10 月 13 日
Hi!
I have a Raspberry Pi that is running a modbus server. In Matlab I can easily communicating with the server by using the Industrial Communication Toolbox:
m = modbus('tcpip', '192.168.XX.XX', 502)
read(m,'holdingregs',49+1,7, 1)
Where the last input to the read function is the serverID.
My problem is that when I try to do the same thing using the modbus blocks in ther Raspberry Pi support package for Simulink there is no obvious way for how I can specify the serverID. Does anyone know how I can specify the serverID when using the modbus communication block in Simulink for Raspberry Pi?
Thanks!

回答 (1 件)

Rijuta
Rijuta 2023 年 10 月 13 日
Hi Kristian,
I understand that you want to specify the server ID of a Modbus communication block in Simulink for Raspberry Pi.
In Modbus communication, the server ID is essentially the address of the server to send the read command to. Simulink Support Package for Raspberry Pi Hardware supports the Modbus communication protocol over the TCP/IP network with the following blocks:
Both these blocks provide ‘Server address’ as a parameter which allows you to enter the IP address of the server device to identify the server from which the client reads the data or to which the client writes the data. The default value of the Server address is 127. You can double click on the block to modify this value.
I hope this solves your query.

カテゴリ

Help Center および File ExchangeRun on Target Hardware についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by