# How to convert 16 bits into a word / integer

**URL:** <https://discourse.nodered.org/t/how-to-convert-16-bits-into-a-word-integer/67263>\
**Category:** General\
**Created:** [2 September 2022 17:52 UTC](https://discourse.nodered.org/t/how-to-convert-16-bits-into-a-word-integer/67263 "2022-09-02T17:52:08Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![HansZnarf](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hansznarf/32/70215_2.png) [@HansZnarf](https://discourse.nodered.org/u/HansZnarf)\
**Post date:** [2 September 2022 17:52 UTC](https://discourse.nodered.org/t/how-to-convert-16-bits-into-a-word-integer/67263/1 "2022-09-02T17:52:08Z")

</div>

Need the reverse of this so dashboard switches can effect a control device.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/7/677f4a03e21b9afa8c9c000c6e231032c9cb66ff.png)

Have looked - any ideas?

Thanks - Hans

---

<div class="post-metadata">

**Author:** ![MecatronicaMADE](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@MecatronicaMADE](https://discourse.nodered.org/u/MecatronicaMADE)\
**Post date:** [2 September 2022 18:14 UTC](https://discourse.nodered.org/t/how-to-convert-16-bits-into-a-word-integer/67263/2 "2022-09-02T18:14:54Z")

</div>

Hi @HansZnarf you need provide more information about!! can you share us your flow?

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [2 September 2022 18:15 UTC](https://discourse.nodered.org/t/how-to-convert-16-bits-into-a-word-integer/67263/3 "2022-09-02T18:15:14Z")

</div>

I think this node does what you want:

> **[node-red-contrib-buffer-parser](https://flows.nodered.org/node/node-red-contrib-buffer-parser)**
>
> Node-red nodes to convert values to and from buffer/array. Supports Big/Little Endian, BCD, byte swapping and much more

---

<div class="post-metadata">

**Author:** ![HansZnarf](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hansznarf/32/70215_2.png) [@HansZnarf](https://discourse.nodered.org/u/HansZnarf)\
**Post date:** [2 September 2022 19:27 UTC](https://discourse.nodered.org/t/how-to-convert-16-bits-into-a-word-integer/67263/4 "2022-09-02T19:27:36Z")

</div>

Cannot take credit for this flow.

---

<div class="post-metadata">

**Author:** ![HansZnarf](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hansznarf/32/70215_2.png) [@HansZnarf](https://discourse.nodered.org/u/HansZnarf)\
**Post date:** [2 September 2022 19:27 UTC](https://discourse.nodered.org/t/how-to-convert-16-bits-into-a-word-integer/67263/5 "2022-09-02T19:27:58Z")

</div>

[flows (4).json](https://discourse.nodered.org/uploads/short-url/hcvyOjukajutI3B36GRKMf1mzzV.json) (645 Bytes)

---

<div class="post-metadata">

**Author:** ![HansZnarf](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hansznarf/32/70215_2.png) [@HansZnarf](https://discourse.nodered.org/u/HansZnarf)\
**Post date:** [2 September 2022 19:30 UTC](https://discourse.nodered.org/t/how-to-convert-16-bits-into-a-word-integer/67263/6 "2022-09-02T19:30:17Z")

</div>

Looking for a block that reverses this process. Take 16 bit and structure it into an Int.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/e/4ea4196fb0b7aec1720951fb4011c584cbab1112.png)

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [2 September 2022 19:31 UTC](https://discourse.nodered.org/t/how-to-convert-16-bits-into-a-word-integer/67263/7 "2022-09-02T19:31:55Z")

</div>

Did you have a look at the node I suggested?

---

<div class="post-metadata">

**Author:** ![HansZnarf](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hansznarf/32/70215_2.png) [@HansZnarf](https://discourse.nodered.org/u/HansZnarf)\
**Post date:** [2 September 2022 19:36 UTC](https://discourse.nodered.org/t/how-to-convert-16-bits-into-a-word-integer/67263/8 "2022-09-02T19:36:02Z")

</div>

Kind of like this

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/a/aaaf6af01986730ffad6aa2e1dda3aaf431bc729.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 September 2022 21:10 UTC](https://discourse.nodered.org/t/how-to-convert-16-bits-into-a-word-integer/67263/9 "2022-09-02T21:10:02Z")

</div>

You were informed in [your previous post](https://discourse.nodered.org/t/bit-strip-from-int/67221) that the buffer-parser node can convert in both directions.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [1 November 2022 21:10 UTC](https://discourse.nodered.org/t/how-to-convert-16-bits-into-a-word-integer/67263/10 "2022-11-01T21:10:37Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
