I'm completely new to modbus so I'm sure the issue is with my code/not understanding pymodbus, thanks for any input in advance. I have a benchtop power supply that accepts modbus instructions, the OEM provided information on the register addresses (at least I thought) at this PDF included with their proprietary software.
I would like to at least interface with this supply but the pymodbus exceptions in the code below are telling me there's no response. Any suggestions
```python
import time
from pymodbus.client import ModbusSerialClient
from pymodbus.exceptions import ModbusIOException
def run():
print("Creating client")
client = ModbusSerialClient("/dev/ttyUSB0", method='rtu', baudrate=9600, stopbits=1, parity='N', bytesize=8, timeout=1)
print("Connecting to client")
if not client.connect():
print("Failed to connect to client")
return
# List of register addresses to read from
register_addresses = [0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0010, 0x0011, 0x0012, 0x0013, 0x0030, 0x0031, 0x0020, 0x0021, 0x0022, 0x0023, 0x9999]
# Read from each register
for address in register_addresses:
try:
response = client.read_holding_registers(address, 1)
if response.isError():
print(f"Error reading register {address}: {response}")
else:
print(f"Register {address}: {response.registers}")
time.sleep(0.035)
except ModbusIOException as e:
print(f"Modbus IO Exception reading register {address}: {e}")
print("Closing client")
client.close()
run()
```