Clear Filters
Clear Filters

How to specify serverID when using modbus for Raspberry Pi?

3 views (last 30 days)
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!

Answers (1)

Rijuta
Rijuta on 13 Oct 2023
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.

Community Treasure Hunt

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

Start Hunting!