Replies: 4 comments 1 reply
-
Simply use the slave ids for the slaves below the tcp modbus server. pymodbus client is pretty simple tu use, see the examples I assume you have the tcp server software if not you are in for a bigger challenge |
Beta Was this translation helpful? Give feedback.
-
Thank you for your reply. As an image, prepare something similar to the contents of client.py (for example, as a function) in the source of server.py, and set the function's operating condition to proceed to the next step if it does not match its own slave ID. ...Is it something like that? Thank you for your kind advice. |
Beta Was this translation helpful? Give feedback.
-
And just to answer your question, no it is a lot more complicated than just adding a function call in the server. A proper serial forwarder needs to be done at framer level, so a proper solution is to interconnect a tcp-server framer with n serial-client framers.....this is something you cannot do with the pymodbus Api, but only by adding code to the library. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the ideas and advice! I'll try again based on your advice! |
Beta Was this translation helpful? Give feedback.
-
Hello everyone,
First of all, let me express my gratitude to the developers who provide pymodbus.
Thank you.
I am a beginner both as a programmer and as a pyModbus user.
I apologize if my question is a duplicate.
My questions are as follows:
Q. In ModbusTCP, how should I write Python code and set the register map in the following configuration?
ex:) Master(Mac) → Slave(RasPi-a) → Slave(RasPi-b)...
Currently, we have completed the basic learning of creating a client request on the Mac side and receiving register values via ModbusTCP, as shown below.
Mac (host :192.168.xxx.2)
↓
↓ protcol :ModbusTCP
↓
RasPi(
host :192.168.xxx.3
GPIO :DHT-11 sensor
)
P.S.ーーーーーーーー
Ultimately, I would like to try a network configuration like the one below.
Mac (host :192.168.xxx.2)
↓
↓ protcol :Modbus TCP
↓
RasPi-a(
host :192.168.xxx.3
)
↓
↓ protcol :Modbus RTU
↓
RasPi-b(
port :tty~~~
GPIO :DHT-11 sensor
)
↓
↓ protcol :Modbus RTU
↓
RasPi-c(
port :tty~~~
GPIO :something sensor
)
↓
↓ protcol :Modbus RTU
↓
any units ...
Beta Was this translation helpful? Give feedback.
All reactions