# Schneider modbus Float32 IEM3350

**URL:** <https://discourse.nodered.org/t/schneider-modbus-float32-iem3350/34574>\
**Category:** Industrial\
**Created:** [20 October 2020 13:58 UTC](https://discourse.nodered.org/t/schneider-modbus-float32-iem3350/34574 "2020-10-20T13:58:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tcaccia](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tcaccia/32/30652_2.png) [@tcaccia](https://discourse.nodered.org/u/tcaccia)\
**Post date:** [20 October 2020 13:58 UTC](https://discourse.nodered.org/t/schneider-modbus-float32-iem3350/34574/1 "2020-10-20T13:58:45Z")

</div>

Hi all,

I'm trying to convert the array that the modbus receiver keep from the IEM3350  
I have some problem:  
when I put this function that I've found on a YouTube video from an official schneider tutorial, it doesn't work:

```auto
const buf = Buffer.from(msg.responseBuffer.buffer);
const value = buf.readFloatBE();
msg.payload = value;

return msg;

```

Then, I tried with another function that I founded on the web; sometimes works...:

```auto
let pay = msg.payload;

const buf = Buffer.allocUnsafe(4);
buf.writeUInt16BE(pay[0],2);
buf.writeUInt16BE(pay[1],0);

msg.payload = buf.readFloatBE(0);
return msg;

```

 ![2020-10-20 15.56.35 172.22.38.253 843c8b17bff7](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/6/c6f825d8cbc70b24fc40a84055bc0aaedd8d877b.jpeg)

...but sometimes give me this error:

> "RangeError [ERR\_OUT\_OF\_RANGE]: The value of "value" is out of range. It must be \>= -32768 and \<= 32767. Received 45267"

Have you the same problem?  
Someone solved it?

Thanks!

---

<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:** [20 October 2020 14:27 UTC](https://discourse.nodered.org/t/schneider-modbus-float32-iem3350/34574/2 "2020-10-20T14:27:02Z")

</div>

> [@tcaccia](#):
>
> Have you the same problem

Many have.

Do your self a favour and use [node-red-contrib-buffer-parser](https://flows.nodered.org/node/node-red-contrib-buffer-parser) it takes care of all the details.

There are quite a few threads that do this - [take a look](https://discourse.nodered.org/search?q=node-red-contrib-buffer-parser) in particular [this one](https://discourse.nodered.org/t/creation-of-function-node/34170/10) and [this one](https://discourse.nodered.org/t/sending-multiple-modbus-data-values-to-sql-server-azure-in-one-stored-procedure/30488/2) and [this one](https://discourse.nodered.org/t/convert-modbus-float-array-register-to-value/26303/4)

---

<div class="post-metadata">

**Author:** ![tcaccia](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tcaccia/32/30652_2.png) [@tcaccia](https://discourse.nodered.org/u/tcaccia)\
**Post date:** [22 October 2020 07:50 UTC](https://discourse.nodered.org/t/schneider-modbus-float32-iem3350/34574/3 "2020-10-22T07:50:48Z")

</div>

Thanks for your support,  
This module seems very interesting.  
Anyway, I've found this function on the web and it's working good...

```auto
var ui16 = new Uint16Array(msg.payload);
var fl32 = new Float32Array(ui16.buffer, ui16.byteOffset, ui16.byteLength / Float32Array.BYTES_PER_ELEMENT);
msg.payload= fl32;
return msg;

```

---

<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:** [5 November 2020 07:50 UTC](https://discourse.nodered.org/t/schneider-modbus-float32-iem3350/34574/4 "2020-11-05T07:50:56Z")

</div>

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