Simple question about Read Holding Registers

Hello, I'm new to Modbus, and I'm still trying to figure things out. I'm using a modbus client on Node Red to get measurments from a VES device and work on them. I can query and read a first string (address 39000, quantity 30), and a second string (address 39030, quantity 20) just fine, but when I try to get them in a single query (address 39000, quantity 50), I got an error code 2. So I must do something wrong, but I don't know what. I hope I gave you enough informations, thanks in advance for your help!
 
It doesn't seem like you're doing anything wrong, but rather possibly running into a limitation of the VES device's Modbus implementation. Can you share the Modbus documentation for the VES device? Maybe there is a mention of such limitations.

There are two things that I can think of that could cause this.

1. The VES device has some limit (under 50) for the maximum number of registers that can be read with a single request.

2. There are differences in the registers in the 39000 - 39049 range that the VES device restricts you from reading them in one block. For example, perhaps they use different encodings (i.e. 16-bit integer, 32-bit integer, 32-bit floating point) or have some other special differences and the VES device does not allow a a single request to encompass the different registers.
 
Section 8.1 in the VSE153 manual you linked shows the maximum length for writes and reads as 123 and 125, respectively, which is the maximum limit for all Modbus RTU devices. Therefore, I do not believe this is the cause of your issue.

However, according to the VSE153 manual register 39000 and register 39030 are special "device identification registers" which are strings and have a length of 30 registers and 20 registers, respectively. Perhaps the device has a restriction where it does not allow you to read both strings in one request. You would need to confirm this with the manufacturer.

Another thing to check is that you are reading the correct registers. "Address 39000" on the VSE153 means Input Register 9000 (the 30000 offset indicates it is an input register and Function Code 4 should be used, it is not actually encoded into the request). This is supported by the following note in section 8.7.1 of the VSE153 manual:
Reading the vendor name in the register 39000 is done in the master tool by querying the register "9000" via FC4

Depending on how Node Red expects the register, you may need to enter 39000, 9000, or possibly 8999 for the register number/address.
 
Firstly, thank you for reminding me that the 30000 offset means I nead to use FC 4, and conversely, 40000 offset means I nead to use FC 3. I read about it (quite confusing) but forgot it when I did my query. I tried all the ways of writting the address you listed above, which make sense to me now, but I still got the same error. I agree with you it must be a device's restriction.

However, I'm even more puzzled now, because while I forgot about the FC3 and 4 "swapping" thing, I managed to get my 8 measurements (4 bytes reals from 40001 to 40015) with this query on NodeRed : FC4, address 0, quantity 16. In order to understand, I changed to FC3, and although I didn't get an error code 2 this time, all I retrieve are zeros.
 
The FC3 and FC4 issue you're seeing may be due to the way you have the VSE153 configured/programmed. In the manual, it shows that registers 30001 - 30015 map to %IW0 - %IW14 and 40001 - 40015 map to %QW0 - %QW14. The %IWx and %QWx addresses are internal memory locations in the VSE153 for input words and output words. Using the device's software, there must be a way to configure what parameters are mapped to those input and output words.
 
Top