I want to write to PLC input registers using pymodbus. I am able to read them :
from pymodbus.client.sync import ModbusTcpClient client = ModbusTcpClient('10.10.10.32') client.connect() reg = client.read_input_registers(1,5) print(reg.registers)
But I still did not found any way how to write any value to them. I appreciate any help. Thanks.
Advertisement
Answer
Input registers are read-only. You can write to holding registers, using Modbus functions Write Single Register or Write Multiple Registers (ModbusTcpClient.write_register or ModbusTcpClient.write_registers in pymodbus).