04-04-2023 01:26 AM
Hello Friends,
I have to write/send values to my energy analyzer which is 2 bytes in size. I can write data in a 1-byte holding register but I can not in 2 bytes register.
I want to send 11000 values to the registered address starting from 786 and as I mentioned it is 2 bytes in size.
Please see my attached snippet and suggest me.
Solved! Go to Solution.
04-04-2023 01:40 AM
Hi,
Like all ModBus registers the Holding register is 16 bits (2 bytes)
Kees
04-04-2023 02:37 AM
oh yes, thanks for the correction. so, in this case, I have 2 words 32 bits where I want to write values (11000) it is decimal values please don't confuse them with binary.
any help, please
04-04-2023 05:45 AM
You can use two Holding Registers where you can splitt into 2 (16 bits)
04-04-2023 06:59 AM
11000 (dec) is 0x2AF8 (hex)
16 bits max. value is 65535. The 11000 fits in one register. If it must be two registers the high register is 0
Kees
04-04-2023 07:27 AM
After looking at your snippet I am going to give you some very pointed advice.
That will vastly improve your code and reduce debugging time.
Finally, your array constant to write to the holding register is empty so, you are literally writing nothing to it.