# NR as Modbus TCP Server cannot write self register

**URL:** https://discourse.nodered.org/t/nr-as-modbus-tcp-server-cannot-write-self-register/25928
**Category:** General
**Created:** [2 May 2020 14:32 UTC](https://discourse.nodered.org/t/nr-as-modbus-tcp-server-cannot-write-self-register/25928 "2020-05-02T14:32:24Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![17greesm](https://avatars.discourse-cdn.com/v4/letter/1/848f3c/32.png) [@17greesm](https://discourse.nodered.org/u/17greesm)
#### Post date: [2 May 2020 14:32 UTC](https://discourse.nodered.org/t/nr-as-modbus-tcp-server-cannot-write-self-register/25928/1 "2020-05-02T14:32:25Z")

</div>

I am not able to write address from modbus write flex node. But I can easily write data from client side.  
Please Note: Node-Red is configured as Modbus TCP Server and used " node-red-contrib-modbus"

```auto
[{"id":"53780dc1.dc8c44","type":"modbus-write","z":"6b0f1c6a.49b4c4","name":"","showStatusActivities":false,"showErrors":true,"unitid":"","dataType":"HoldingRegister","adr":"2","quantity":"1","server":"701921dd.3ccc","emptyMsgOnFail":true,"x":460,"y":860,"wires":[[],["ee17f719.e3a978"]]},{"id":"ee17f719.e3a978","type":"modbus-response","z":"6b0f1c6a.49b4c4","name":"","registerShowMax":20,"x":730,"y":860,"wires":[]},{"id":"ff0d6550.2f4058","type":"inject","z":"6b0f1c6a.49b4c4","name":"","topic":"","payload":"12","payloadType":"num","repeat":"2","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":760,"wires":[["fe5bc982.0f2108"]]},{"id":"fe5bc982.0f2108","type":"modbus-server","z":"6b0f1c6a.49b4c4","name":"","logEnabled":false,"hostname":"127.0.0.1","serverPort":10502,"responseDelay":100,"delayUnit":"ms","coilsBufferSize":"0","holdingBufferSize":"100","inputBufferSize":"0","discreteBufferSize":"0","showErrors":false,"x":320,"y":740,"wires":[["cfc2fc8a.88d73"],[],[],[],[]]},{"id":"cfc2fc8a.88d73","type":"debug","z":"6b0f1c6a.49b4c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":550,"y":740,"wires":[]},{"id":"d38739bf.6ee658","type":"inject","z":"6b0f1c6a.49b4c4","name":"","topic":"","payload":"12","payloadType":"num","repeat":"3","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":840,"wires":[["53780dc1.dc8c44"]]},{"id":"701921dd.3ccc","type":"modbus-client","z":"6b0f1c6a.49b4c4","name":"Modbus Flex Server","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"tcpHost":"127.0.0.1","tcpPort":"18502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"1","commandDelay":"1","clientTimeout":"1000","reconnectTimeout":"2000"}]

```

---

<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: [2 May 2020 16:13 UTC](https://discourse.nodered.org/t/nr-as-modbus-tcp-server-cannot-write-self-register/25928/2 "2020-05-02T16:13:47Z")

</div>

it is not clear what you need to do.

can't write to an instrument on the network?

but can you successfully publish the data to a client?

you should put some more data.

---

<div class="post-metadata">

### Author: ![17greesm](https://avatars.discourse-cdn.com/v4/letter/1/848f3c/32.png) [@17greesm](https://discourse.nodered.org/u/17greesm)
#### Post date: [2 May 2020 16:46 UTC](https://discourse.nodered.org/t/nr-as-modbus-tcp-server-cannot-write-self-register/25928/3 "2020-05-02T16:46:25Z")

</div>

Yes, I am able to establish communication with client that means client can read and write. But I cannot write any data from Node-Red which is the main purpose of being creating it as a server.

---

<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: [2 May 2020 17:23 UTC](https://discourse.nodered.org/t/nr-as-modbus-tcp-server-cannot-write-self-register/25928/4 "2020-05-02T17:23:31Z")

</div>

if you want to publish data on the network as a server to a client you must set the network address of your PC in the node-red server configuration.

in the flow you posted you put 127.0.0.1 which is the local host,  
also you must:

> use the same port as the client (502, 10502, etc.)  
> set the ID parameter that the client will have to point to (1, 2, 3)  
> set the addresses to be read by the client

---

<div class="post-metadata">

### Author: ![17greesm](https://avatars.discourse-cdn.com/v4/letter/1/848f3c/32.png) [@17greesm](https://discourse.nodered.org/u/17greesm)
#### Post date: [2 May 2020 17:44 UTC](https://discourse.nodered.org/t/nr-as-modbus-tcp-server-cannot-write-self-register/25928/5 "2020-05-02T17:44:45Z")

</div>

I already assigned all configuration but it didn't work.  
As I said communication is done. But couldn't write data from Node-Red. I think there might be some issue with the node or I am missing something important.

---

<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: [1 July 2020 17:49 UTC](https://discourse.nodered.org/t/nr-as-modbus-tcp-server-cannot-write-self-register/25928/6 "2020-07-01T17:49:52Z")

</div>

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