Reading registers with pymodbus

Deadly 提交于 2019-11-30 14:12:26
Azat

Try to:

 response = client.read_holding_registers(0x00,4,unit=1)

where the unit value is device id of the slave.

To print all:

print response.registers

Also is possible to directly get one value (for example third register):

print response.getRegister(2)

or

print response.registers[2]  

you could parse the response by yourself, the following is my code snippet:

    result = client.read_input_registers(0x01,1, unit=0x01)
    #print result
    t = result.registers[0]
    print "current temperature:", t, "  ", float(t/100.0)
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!