# Modbus Multi Register Writing

**URL:** https://discourse.nodered.org/t/modbus-multi-register-writing/22823
**Category:** General
**Created:** [9 March 2020 00:40 UTC](https://discourse.nodered.org/t/modbus-multi-register-writing/22823 "2020-03-09T00:40:38Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![rromele](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rromele/32/18431_2.png) [@rromele](https://discourse.nodered.org/u/rromele)
#### Post date: [9 March 2020 00:40 UTC](https://discourse.nodered.org/t/modbus-multi-register-writing/22823/1 "2020-03-09T00:40:38Z")

</div>

Hi, everyone, I have a small problem to solve related to the Modbus protocol,

I receive a hundred data in floating point 32 bit format from various instruments and plc on the network, I should retransmit them via Modbus Tcp / Ip to hmi in the same format.

I am using Modbus Flex Write function, but I cannot correctly compose the message to send more variables to the node.

I attach part of the "test" code with only three variables, is someone able to give me some help, or to give me straight for a professional solution?

Thank you all

 ![00](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/c/ec62f74577efb637edd278e75603af5ec9209cce.png)

---

<div class="post-metadata">

### Author: ![Hobbe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hobbe/32/18174_2.png) [@Hobbe](https://discourse.nodered.org/u/Hobbe)
#### Post date: [9 March 2020 08:44 UTC](https://discourse.nodered.org/t/modbus-multi-register-writing/22823/2 "2020-03-09T08:44:52Z")

</div>

Hi! I get error messages when I import your code. Could it have been something wrong when you pasted the code?

Regards  
// Hobbe

---

<div class="post-metadata">

### Author: ![rromele](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rromele/32/18431_2.png) [@rromele](https://discourse.nodered.org/u/rromele)
#### Post date: [9 March 2020 09:30 UTC](https://discourse.nodered.org/t/modbus-multi-register-writing/22823/3 "2020-03-09T09:30:34Z")

</div>

....... sorry, I attach the flow file,

[mdb.json](https://discourse.nodered.org/uploads/short-url/opLsJz2dpF83tq6B3pOTUflNGQO.json) (1.9 KB)

this should be the code of the "Build message" function which is the source of the problemthis should be the code of the "Build message" function which is the source of the problem:

var a = msg.payload["2"];  
var b = msg.payload["3"];  
var c = msg.payload["4"];  
send =[a,b,c];

msg.payload = {  
'value' : send,  
'fc': 16,  
'unitid': 1,  
'address': 1,  
'quantity': 3 }  
return msg;

thank

---

<div class="post-metadata">

### Author: ![Hobbe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hobbe/32/18174_2.png) [@Hobbe](https://discourse.nodered.org/u/Hobbe)
#### Post date: [9 March 2020 12:42 UTC](https://discourse.nodered.org/t/modbus-multi-register-writing/22823/4 "2020-03-09T12:42:44Z")

</div>

Can you please save your entire flow.

// Hobbe

---

<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: [8 May 2020 12:42 UTC](https://discourse.nodered.org/t/modbus-multi-register-writing/22823/5 "2020-05-08T12:42:47Z")

</div>

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