LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to write 2 bytes modbus holding register

Solved!
Go to solution

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.

 

 

0 Kudos
Message 1 of 6
(2,491 Views)

Hi,

 

Like all ModBus registers the Holding register is 16 bits (2 bytes)

 

Kees

0 Kudos
Message 2 of 6
(2,487 Views)

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

0 Kudos
Message 3 of 6
(2,467 Views)

You can use two Holding Registers where you can splitt into 2 (16 bits)

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 4 of 6
(2,450 Views)
Solution
Accepted by Asif138

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

0 Kudos
Message 5 of 6
(2,439 Views)

After looking at your snippet I am going to give you some very pointed advice.

 

  • SHOW the radix on all of your integer constants.  
  • Chose appropriate display formats for your constants.
  • LABLE all of your constants
  • Add attached comments with good information like "Register Name pg 5-3" so the next developer can look it up easy.

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.


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 6
(2,429 Views)