# Help writing 16-bit data via Modbus to a VFD

**URL:** <https://discourse.nodered.org/t/help-writing-16-bit-data-via-modbus-to-a-vfd/81057>\
**Category:** General\
**Tags:** modbus\
**Created:** [5 September 2023 16:18 UTC](https://discourse.nodered.org/t/help-writing-16-bit-data-via-modbus-to-a-vfd/81057 "2023-09-05T16:18:42Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [5 September 2023 16:29 UTC](https://discourse.nodered.org/t/help-writing-16-bit-data-via-modbus-to-a-vfd/81057/2 "2023-09-05T16:29:59Z")

</div>

> [@grant1](#):
>
> To start with, all I want to send is START and FORWARD, so I presume (per the above table):

Then you can simply set the value to `1` for stop or `2` for start.

in essance, that is

| bit | hex | binary | decimal |
| --- | --- | --- | --- |
| 0 | 0x0001 | `0000 0000 0000 0001` | 1 |
| 1 | 0x0002 | `0000 0000 0000 0010` | 2 |

* * *

The difficulty comes when you need to track actual value and set/clear bits before writing.

The 2nd difficulty is when you need to set multiple bits.

I recommend you make a helper function using [this code](https://discourse.nodered.org/t/node-red-contrib-remote-io-digital-output-for-joining-bool-to-word/11798/2) - probably a good candidate for a link-call or subflow.

---

_[View the full topic](https://discourse.nodered.org/t/help-writing-16-bit-data-via-modbus-to-a-vfd/81057)._
