Skip to content

pymodbus.client.sync.ModbusTcpClient read_input_registers get none ? #38

@fengrujun

Description

@fengrujun

HI,sorry for my poor english!
Why my tcp client get none after perfoming function 'read_input_registers'?My code is:
from pymodbus.client.sync import ModbusTcpClient as ModbusClient

 import logging
 logging.basicConfig()
 log = logging.getLogger()
 log.setLevel(logging.DEBUG)

 client = ModbusClient('192.1.8.146', port=26)
 client.connect()
 arguments = {
 'read_address':    0,
 'read_count':      1,
 'write_address':   1,
 'write_registers': 1,
}
 rq = client.readwrite_registers(**arguments)
 rr = client.read_input_registers(0,16)
 print rr    
 client.close()

The result is:
DEBUG:pymodbus.transaction:Running transaction 1
DEBUG:pymodbus.transaction:0x4d 0x4f 0x44 0x42 0x55 0x53
DEBUG:pymodbus.transaction:getting transaction 1
DEBUG:pymodbus.transaction:Running transaction 2
DEBUG:pymodbus.transaction:0x0 0x2 0x0 0x0 0x0 0x23 0x1 0x4 0x20 0x9a 0xf9 0x79 0xc4 0x9a 0xf9 0x79 0xc4 0x9a 0xf9 0x79 0xc4 0x9a 0xf9 0x79 0xc4 0x9a 0xf9 0x79 0xc4 0x0 0x0 0xc0 0x41 0x9a 0xf9 0x79 0xc4 0x66 0x66 0xbe 0x41
DEBUG:pymodbus.transaction:getting transaction 2
None

I use a modbus/tcp  to modbus/rtu gatway as a server,i test it with Modbus Poll,it can get the correct datas,i am sure the device is ok,so i don't know where is going wrong...

Thank you!
Billy apple

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions