node-modbus-serial icon indicating copy to clipboard operation
node-modbus-serial copied to clipboard

read/write more than 256 registers at once

Open lqin2333 opened this issue 3 years ago • 1 comments

Hi,

If I want to read/write the values of more than 256 registers (e.g. 300 registers) starting at address 0 at once, are there any options I can set?

Thank you in advance :)

lqin2333 avatar May 10 '22 06:05 lqin2333

Hi. You can only write 123 holding registers with a single request (function 16). There is only 1 byte that defines the number of data bytes, so writing 300 16-bit registers is impossible. And most Modbus devices only allow you to write a few registers at a time to them, 8 or 16 isn't uncommon. But more modern devices can often support 100 registers or more.

But if you are talking about coils, the maximum should be 1968 coils written per request (function 15).

I have not checked what this library supports as maximum for each function, I just wanted to clarify that it's impossible to write 300 holding registers with a single request. You need to split it into several requests.

Xsandor avatar Nov 30 '22 20:11 Xsandor