简体   繁体   English

Pymodbus3:如何在Modbus串行客户端中指定从站的ID

[英]Pymodbus3: How to specify a slave's ID in Modbus Serial Client

I am trying to connect my computer to a Modbus serial connection using pymodbus3 but I am not able to specify the slave_id to each request. 我正在尝试使用pymodbus3将计算机连接到Modbus串行连接,但无法为每个请求指定slave_id。 I have been reading the code and I have seen that pymodbus3 always work with slave's ID 1 (unit_id in the code). 我一直在阅读代码,并且看到pymodbus3始终与从站的ID 1(代码中的unit_id)一起使用。 This is good if you only have a one-to-one connection. 如果您只有一对一的连接,那就很好。

Thanking in advance. 在此先感谢。

这对我有用pymodbus3

rr = client.read_holding_registers(0x5B00,100, unit=0x02)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM