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.
Do you have to communicate over Modbus? Im not familiar with that but i use another Method. Saia PCD's do accept CGI calls which are very easy to make. On their Website is a good Documentation for Webservers and CGI. If you consider to use this kind of communication, i can may help you with a library i wrote to read/write Registers and to read errors from any PCD.