# Modbus binding - issue with writing 32-Bit values

**URL:** <https://community.openhab.org/t/modbus-binding-issue-with-writing-32-bit-values/10133>\
**Category:** Bindings\
**Created:** [April 26, 2016, 10:39am UTC](https://community.openhab.org/t/modbus-binding-issue-with-writing-32-bit-values/10133 "2016-04-26T10:39:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris84](https://community.openhab.org/letter_avatar_proxy/v4/letter/c/dbc845/32.png) [@Chris84](https://community.openhab.org/u/Chris84)\
**Post date:** [April 26, 2016, 10:39am UTC](https://community.openhab.org/t/modbus-binding-issue-with-writing-32-bit-values/10133/1 "2016-04-26T10:39:12Z")

</div>

Hello,

can anyone confirm that there is an issue with writing 32-Bit values via Modbus-binding in OH 1.8.2?

I have to write a uint32 into two holding registers (2x 16 bit) over (TCP) Modbus function code 0x10.  
It is important that the write request for the two registers arrive the slave in one tcp packet!

My openhab modbus config looks like that:

```
modbus:writemultipleregisters=true

modbus:tcp.slave1.connection=192.168.x.x
modbus:tcp.slave1.type=holding
modbus:tcp.slave1.start=1
modbus:tcp.slave1.length=2
modbus:tcp.slave1.valuetype=uint32

```

Item config:  
`Number example "example [%d]"	{modbus="slave1:0"}`

For example: When I try to write the decimal value “196608” (bin 11 0000 0000 0000 0000) the tcp packet only contains a write request for the first register with the decimal value 0.  
the second (expected) register, with the other 16 bits, are not sent. (captured with tcpdump)

Other example: I try to write the decimal value ‘3’ (11) the tcp packet also contains only one register. This request contains the vlaue ‘3’.

---

<div class="post-metadata">

**Author:** ![rossko57](https://community.openhab.org/user_avatar/community.openhab.org/rossko57/32/70263_2.png) [@rossko57](https://community.openhab.org/u/rossko57)\
**Post date:** [April 28, 2016, 10:36am UTC](https://community.openhab.org/t/modbus-binding-issue-with-writing-32-bit-values/10133/2 "2016-04-28T10:36:51Z")

</div>

How are you setting the example value, maybe type casting needed there?

---

<div class="post-metadata">

**Author:** ![Chris84](https://community.openhab.org/letter_avatar_proxy/v4/letter/c/dbc845/32.png) [@Chris84](https://community.openhab.org/u/Chris84)\
**Post date:** [April 28, 2016, 8:35pm UTC](https://community.openhab.org/t/modbus-binding-issue-with-writing-32-bit-values/10133/3 "2016-04-28T20:35:11Z")

</div>

Hi rossko57,

I do it in the sitemap like that:

> Switch item=example mappings=[0 = “off”, 65536 = “1”, 131072 = “2”, 196608 = “3”, 262144 = “4”]

or for the other:

> Switch item=example mappings=[0 = “off”, 1 = “1”, 2 = “2”, 3 = “3”, 4 = “4”]
