Skip to content Skip to sidebar Skip to footer

Pymodbus Exception Response(131, 3, Illegaladdress)

I'm trying to run this piece of code: from pymodbus.client.sync import ModbusSerialClient as ModbusClient import logging logging.basicConfig() log = logging.getLogger() log.setLev

Solution 1:

I am assuming you want to read the first seven holding registers. In that case, the address to be given to the read_holding_registers function is 0. The function implicitly adds the offset of 40000 for holding registers.

So, try changing your read code to this

rr = client.read_holding_registers(0, 7, unit=0x01)

Solution 2:

Exception Response(131, 3, IllegalAddress) means:

A value contained in the query data field is not an allowable value for the slave. This indicates a fault in the structure of remainder of a complex request, such as that the implied length is incorrect. It specifically does NOT mean that a data item submitted for storage in a register has a value outside the expectation of the application program, since the MODBUS protocol is unaware of the significance of any particular value of any particular register.

http://www.simplymodbus.ca/exceptions.htm


[UPDATE]:

Did you try with 0x40000 or 0x400 (as a default in many cases)? 0x40000 (hexadecimal) have different with 40000 (decimal)

Post a Comment for "Pymodbus Exception Response(131, 3, Illegaladdress)"