# Modbustcp write fc15

**URL:** <https://discourse.nodered.org/t/modbustcp-write-fc15/37347>\
**Category:** Industrial\
**Created:** [11 December 2020 12:05 UTC](https://discourse.nodered.org/t/modbustcp-write-fc15/37347 "2020-12-11T12:05:39Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![serinmo](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@serinmo](https://discourse.nodered.org/u/serinmo)\
**Post date:** [11 December 2020 12:05 UTC](https://discourse.nodered.org/t/modbustcp-write-fc15/37347/1 "2020-12-11T12:05:39Z")

</div>

Hi,

I'm trying to switch a simple on/off by modbustcp write but is imposible...

I can read prefectly array from plc (Arduino, with mudbus.h library)

 ![ok](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/9/8960b69c1e27d8d7cc66b5acf1ff33078102cc79.png)

but I can't write, always recived error about is not an array.

![ko_01](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/5/25b74fae61399b14d98c0a29da857c537621abdc.png)

I need the funcion F15, the F5 doesn't work, with modbus test app F15 works fine

Thanks

---

<div class="post-metadata">

**Author:** ![serinmo](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@serinmo](https://discourse.nodered.org/u/serinmo)\
**Post date:** [11 December 2020 12:06 UTC](https://discourse.nodered.org/t/modbustcp-write-fc15/37347/2 "2020-12-11T12:06:17Z")

</div>

![ko_02](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/0/60a74a23f55e03460800e02f637776ddbb6e1b10.png)  
 ![aurduino](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/d/1d6ebe1ae8d8156f2b6d2c21479aafe13d9f6b75.png)

---

<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:** [11 December 2020 15:43 UTC](https://discourse.nodered.org/t/modbustcp-write-fc15/37347/3 "2020-12-11T15:43:08Z")

</div>

> For FC 5, **msg.payload** must be a value of 1 or 0 or true or false  
> For FC 15, **msg.payload** must be an `array[]` of comma separated values true or false

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

Put a debug node AFTER the switch node - what are you feeding into the modbus node?

* * *

### EDIT

Just realised the node icons in your screenshot are different to mine - you might be using a different set of modbus nodes to me (it is always a good idea to provide a link or the full name of the contrib node you are using (to save everyone some time)). My info above ↑ us using [node-red-contrib-modbus](https://flows.nodered.org/node/node-red-contrib-modbus)

---

<div class="post-metadata">

**Author:** ![serinmo](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@serinmo](https://discourse.nodered.org/u/serinmo)\
**Post date:** [11 December 2020 15:47 UTC](https://discourse.nodered.org/t/modbustcp-write-fc15/37347/4 "2020-12-11T15:47:12Z")

</div>

![MODBUSTCP](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/4/0402b5aaa70d152c2a7b832445d555a60f04ae94.png)

This is my node, I know about array, but I don't know how do it

---

<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:** [11 December 2020 16:02 UTC](https://discourse.nodered.org/t/modbustcp-write-fc15/37347/5 "2020-12-11T16:02:59Z")

</div>

> [@serinmo](#):
>
> I don't know how do it

How to do what? How many coils do you want to set, and what value(s) do you need to write?

---

<div class="post-metadata">

**Author:** ![serinmo](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@serinmo](https://discourse.nodered.org/u/serinmo)\
**Post date:** [11 December 2020 16:03 UTC](https://discourse.nodered.org/t/modbustcp-write-fc15/37347/6 "2020-12-11T16:03:57Z")

</div>

I only need one coil, with value 1/0

---

<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:** [11 December 2020 16:06 UTC](https://discourse.nodered.org/t/modbustcp-write-fc15/37347/7 "2020-12-11T16:06:27Z")

</div>

What comes out of the switch node? (Add a debug node and post screenshot)

Also post a screenshot of the config of the switch node.

(You will have to indulge me as I am not at a computer and can't check for myself)

---

<div class="post-metadata">

**Author:** ![serinmo](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@serinmo](https://discourse.nodered.org/u/serinmo)\
**Post date:** [11 December 2020 16:10 UTC](https://discourse.nodered.org/t/modbustcp-write-fc15/37347/8 "2020-12-11T16:10:21Z")

</div>

![switch_01](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/9/e95627f77c6346d025d90ae390741bbe57b4f33e.png) ![switch_02](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/3/a3b2138dc2b46d038f13596baf426012508bd2d4.png)

---

<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:** [11 December 2020 16:29 UTC](https://discourse.nodered.org/t/modbustcp-write-fc15/37347/9 "2020-12-11T16:29:07Z")

</div>

Does the "on" and "off" payload permit you to enter JSON? if so then choose that& enter value `[1]` or `[0]`

---

<div class="post-metadata">

**Author:** ![serinmo](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@serinmo](https://discourse.nodered.org/u/serinmo)\
**Post date:** [11 December 2020 18:15 UTC](https://discourse.nodered.org/t/modbustcp-write-fc15/37347/10 "2020-12-11T18:15:04Z")

</div>

Hi,

Finally is work correctly, I change my node modbustcp and I installed the modbus node like you.

Thanks

---

<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:** [9 February 2021 18:15 UTC](https://discourse.nodered.org/t/modbustcp-write-fc15/37347/11 "2021-02-09T18:15:08Z")

</div>

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