# How to decode 16 bit unsigned integer

**URL:** <https://discourse.nodered.org/t/how-to-decode-16-bit-unsigned-integer/38114>\
**Category:** General\
**Created:** [27 December 2020 21:57 UTC](https://discourse.nodered.org/t/how-to-decode-16-bit-unsigned-integer/38114 "2020-12-27T21:57:15Z")\
**Posts on this page:** 1\
**Showing post:** 19

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [28 December 2020 14:39 UTC](https://discourse.nodered.org/t/how-to-decode-16-bit-unsigned-integer/38114/19 "2020-12-28T14:39:08Z")

</div>

The modbus node gives you back an array reply for the range of modbus registers you requested.  
Its up to you to make calculations later and with the use of Buffer-parser to convert them to the correct type depending on the manufacturer.

See a post from Steve regarding the calculations he made in that example as to what registers to read and what offset to use.

1 register = 2 bytes = 16bits  
32bit values need 4 bytes and from the device docs you'll see that you need to read two registers to calc. them.

> [@Adding two values](https://discourse.nodered.org/t/adding-two-values/32784/35):
>
> Here is my complete post again - try it & see where you get to... Hi again, as mensioned earlier, this is how you can do it with buffer parser... (obviously I dont have your invertor so all values are simulated - zero) this is the flow i did... [{"id":"3c70a20c.01d53e","type":"inject","z":"15164b61.40f905","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":220,"y":300,"wires":[["bb340a9c.a81c58","7bdb6cd4.f23b24","58e3f…

---

_[View the full topic](https://discourse.nodered.org/t/how-to-decode-16-bit-unsigned-integer/38114)._
