0

I am trying to read the registers and flags of the saia sbc PCD2 M4_x ​​plc via Modbus TCP communication. I know the IP address and the communication port of the plc, however every time I read a flag or a register I always get different values ​​from those set. I'm sure it's not a register offset problem that usually occurs in modbus communication. The code I wrote is the one listed and also the results.

from easymodbus.modbusClient import ModbusClient
modbusclient = ModbusClient(IP_address, Port)
modbusclient.connect()
read = modbusclient.read_coils(0, 10)
print(read)
modbusclient.close()

read=[False, False, True, False, True, True, False, False, False, False]

however the flags 0 through 10 do not have that state and even if I change it when I start the written code the result remains the same. Even if I change addresses.

4

1 回答 1

0

您必须通过 Modbus 进行通信吗?我不熟悉,但我使用另一种方法。Saia PCD 确实接受很容易进行的 CGI 调用。在他们的网站上有一个很好的 Web 服务器和 CGI​​ 文档。如果您考虑使用这种通信,我可以帮助您使用我编写的库来读取/写入寄存器并从任何 PCD 读取错误。

于 2020-12-23T20:34:57.020 回答