- ‘Modbus TCP/IP Client Read’: https://www.mathworks.com/help/supportpkg/raspberrypi/ref/modbustcpipclientread.html?s_tid=doc_ta
- ‘Modbus TCP/IP Client Write’: https://www.mathworks.com/help/supportpkg/raspberrypi/ref/modbustcpipclientwrite.html?s_tid=doc_ta#mw_47bfb4d1-3a0d-4ba3-9d91-4437214e44c7
How to specify serverID when using modbus for Raspberry Pi?
11 次查看(过去 30 天)
显示 更早的评论
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!
0 个评论
回答(1 个)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Run on Target Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!