# MODBUS 16bit SIGNED INTEGER

**URL:** <https://discourse.nodered.org/t/modbus-16bit-signed-integer/25362>\
**Category:** General\
**Created:** [23 April 2020 12:27 UTC](https://discourse.nodered.org/t/modbus-16bit-signed-integer/25362 "2020-04-23T12:27:44Z")\
**Posts on this page:** 1\
**Showing post:** 5

<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:** [23 April 2020 13:18 UTC](https://discourse.nodered.org/t/modbus-16bit-signed-integer/25362/5 "2020-04-23T13:18:52Z")

</div>

is that directly from the MODBUS node?

Some of the modbus nodes output a buffer object.

And if it is a buffer then its pretty simple : in a function node (untested)...

```auto
let buf = msg.payload;
msg.converted = [];
msg.converted[0] = buf.readInt16BE();
msg.converted[1] = buf.readInt16BE();
msg.converted[2] = buf.readInt16BE();
//... etc ...
return msg;

```

see [buffer documentation](https://nodejs.org/api/buffer.html#buffer_buf_readint16be_offset) for a whole raft of `read` functions (for when you ask how to read floats next 😉 )

---

_[View the full topic](https://discourse.nodered.org/t/modbus-16bit-signed-integer/25362)._
