Домашняя › Forums › Power supplies › DPSmaster › Reply To: DPSmaster
Dear Profi-max,
Thank you for the superb DPS software!
I would like to read and store the calibration data via modbus, I have looked for a solution but did not find it.
Looking at the data structure calibration starts somewhere at offset 0x320 in the structure:
0x0320 ModbusDataSet_t.Calib
0x0320 CalibData_t.Uin1
0x0328 CalibData_t.Uin2
…
Below is a sample of the python code use to fetch some data and it works great.
I suspect there is maybe some sequence in order to read the contents.
– Write memory offset location
– Read memory value
Is there some way?
Kind regards,
hve
#!/usr/bin/env python3
import minimalmodbus
from time import sleep
dps = minimalmodbus.Instrument(‘/dev/ttyUSB0’, 1) # port name, slave address (in decimal)
dps.serial.baudrate = 115200
dps.serial.timeout = 1/10
dps.write_register(6, 1)
sleep(dps.serial.timeout)
print(“lock”)
STATE = dps.read_register(14)
print(“USET”, dps.read_register(0,2))
print(“ISET”, dps.read_register(1, 3 if STATE & 8 else 2))
print(“UOUT”, dps.read_register(2,2))
print(“IOUT”, dps.read_register(3, 3 if STATE & 8 else 2))
print(“POWER”, dps.read_register(4,1))
print(“UIN”, dps.read_register(5,2))
print(“PROTECT”, dps.read_register(7))
print(“CVCC”, dps.read_register(8))
print(“ONOFF”, dps.read_register(9))
print(“MODEL”, dps.read_register(11))
print(“FIRMWARE”, dps.read_register(12))
print(“TMP”, dps.read_register(13))
print(“OHP”, dps.read_register(23))
dps.write_register(6, 0)
print(“unlock”)
