ljean / modbus-tk

Create Modbus app easily with Python
Other
566 stars 212 forks source link

Cannot write to address more than 100 for holder registers #102

Open sresam89 opened 6 years ago

sresam89 commented 6 years ago

If i try to read/write on address greater than 100 I am getting Modbus error: Exception Code =2

blotsome commented 6 years ago

Can you copy and paste the exact code you are using to get this error?

sudemo commented 5 years ago

this is probably because the reg address is out of range ,maybe your hardware only has 0-100 registers

jacksonmatheson commented 4 years ago

This is not a bug of modbus_tk as you have received a response from the slave. Enable verbose logging and you will see that it is the slave that responded with the exception code.

See in defines.py ILLEGAL_DATA_ADDRESS = 2

You are polling something that is out of range, this could either mean an address that doesn't exist OR that there is a max amount you can request per poll.

I regularly see this with amounts as low as even 20 on older modbus devices, try splitting up the requests into smaller <100 len chunks.

Hope that makes sense.