Set address for Holding Register




Hello Team,
I want to send command “access read” at Holding Register 40900 offset 147, and get data of tagEPC at Holding Register 41000 offset 10.0. Would you mind showing me how to do it? Any advice will be appreciated.

You may have trouble communicating with this device using our driver because it has laid out its data at a “byte” resolution, where Modbus only supports 16-bit and Boolean values. Our driver can combine one or more 16-bit values into larger types, but it doesn’t support addressing only 1 byte inside a 16-bit register.

@pturmel does your driver support this?

My driver supports unsigned bit fields within 16 bit registers, 1-15 bits long. So this could be laid out in my driver. I suspect the whole range has to be written with one command, which means every element must be present in a .writeValues() call to get them to combine into one.

That said, I don’t see any reason why bytes can’t be combined in pairs to write to the corresponding 16-bit register and build up a .writeValues() call that way.

Yeah, it just looks to me like it won’t be possible to write to the “Command” byte without also writing the “TagLen” byte in the same call, so you’d have to read the TagLen value and make sure you don’t write a new one in the subsequent write call.

There’s also the possibility the device expects the entire 156 byte structure to be written at once - I can’t tell from the documentation.

Sorry I am kind of lost, would you mind giving a script example that may apply to my case?

If set up as a bit field in my driver, it would use a function 22. However, the table says all of this is write-only, with a specified length. I would expect to have to use a single function code with all specified words.