I have a device connected to a computer's COM port. Communication with the device takes place via the modbus protocol. I need to read some information from this device - the event log. The instrument documentation is not very extensive, but it says the following:
As far as I understand, in order to initialize the log reading process, I need to write the value 1 to register 100.
Also in the documentation there is an example request:
[17:13:20:034] Written data (COM10)
01 10 7e f4 00 01 02 00 01 ec e3 // reg. 100 // Entire log upload transfer control register, address 100 . In parameter 1.
[17:13:20:050] Read data (COM10)
01 10 7e f4 00 01 58 13
I don't know how to understand this example correctly, so I don't know if I'm doing everything right. My code below doesn't throw an error but doesn't produce any result. The reading process is not initialized and nothing works. What am I doing wrong? How can I correctly implement the query from the example above in python?
from pymodbus.client.sync import ModbusSerialClient as ModbusClient
client = ModbusClient(method='rtu', port=port, stopbits=2, bytesize=8, parity='N', baudrate=19200)
client.connect()
client.write_register(address=100, value=1, unit=1)
Problem solved. Just had to use 'write_registerS' instead of 'write_register'.