Illegal adress for a 32 bit value

Hello,

I am working on data logging inverters that communicate using ModBus.
I can retrieve most values with a simple python script sending requests via RS485, but 30% of the requests returns an "Illegal data adress error". Not much info on this error except: "the address might not exist"... which it does though. Some forums indicated that the value is stored in a "block" of register and cannot allow a user to access only one of the registers individually.
So i looked up my registers and it looks like the ones returning an error are values stored as 32bit integers or floats. This means i cannot access them without requesting 2 registers at the same time? For example:
- Register 40200: value1 (32Uint)
- Register 40202: value2 (16int)
I can access value at 40202 but neither value in 40200 and 40201. How do i even ask the slave that i need both register values at the same time? Can my request hold an information containing how many registers i want?

Thanks in advance for your help!
 
I believe you're correct, you need to read the 2 registers in a single Modbus request to read the 32-bit values from your slave device. If register 40200 has a 32-bit unsigned integer, you must read both 40200 and 40201 in a single request.

This restriction is vendor-specific, but some devices do prevent a Modbus Master from reading only 1 register of a 32-bit value stored in 2 consecutive registers, so that the values cannot be out of sync.

Are you using a Modbus library to make Modbus requests, or are you manually creating your own requests in your python script?

A Modbus Read Holding Registers (function code 03) request allows you to read up to 125 consecutive registers with a single request. Refer to section 6.3 of the spec here:
https://modbus.org/docs/Modbus_Application_Protocol_V1_1b3.pdf
 
Hey!
thanks for your reply, i am indeed using a modbus library (minimalmodbus), problem is, i didn't see anywhere in the code a way to read multiple registers at once? I will look more into it tomorrow, and i will check that link too!
Thanks for your answer
 
Top