# Help to read data using modbus tcp protocol

**URL:** <https://discourse.nodered.org/t/help-to-read-data-using-modbus-tcp-protocol/13837>\
**Category:** General\
**Created:** [30 July 2019 11:33 UTC](https://discourse.nodered.org/t/help-to-read-data-using-modbus-tcp-protocol/13837 "2019-07-30T11:33:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashish\_8284](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ashish_8284/32/3908_2.png) [@ashish\_8284](https://discourse.nodered.org/u/ashish_8284)\
**Post date:** [30 July 2019 11:33 UTC](https://discourse.nodered.org/t/help-to-read-data-using-modbus-tcp-protocol/13837/1 "2019-07-30T11:33:36Z")

</div>

Hi friends,  
i am new to nodered. i have install nodered on my windows PC. i tried to read data of ModbusTcp slave device using node-red-contrib-modbustcp node.  
i tried a lot but not getting success.  
Hardware :- Energy meter Schnider make EM6400  
protocol :- Modbus RTU  
i used Modbus RTU to Modbus TCP converter :- Moxa nPort

my node setting is as below.

```auto
[{"id":"389dd15.abbbc2e","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"77017325.c2109c","type":"json","z":"389dd15.abbbc2e","name":"","property":"payload","action":"","pretty":false,"x":345.5,"y":80,"wires":[["9f704bd8.524f28"]]},{"id":"9f704bd8.524f28","type":"debug","z":"389dd15.abbbc2e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":514,"y":83,"wires":[]},{"id":"ceae684d.ef9ad8","type":"modbustcp-read","z":"389dd15.abbbc2e","name":"J10_AC_FDR","topic":"","dataType":"InputRegister","adr":"03010","quantity":"1","rate":"5","rateUnit":"s","server":"994e50ef.932f8","ieeeType":"single","ieeeBE":"false","x":164,"y":73,"wires":[["77017325.c2109c"]]},{"id":"994e50ef.932f8","type":"modbustcp-server","z":"","name":"J10","host":"192.168.0.98","port":"502","unit_id":"1","reconnecttimeout":"5"}]

```

Error is as below

> Blockquote  
> 7/30/2019, 4:47:56 PM[node: J10\_AC\_FDR](http://192.168.0.35:1880/)msg : string[133]  
> "ModbusTCPClient: {"err":"ModbusException","response":{"\_id":5,"\_protocol":0,"\_bodyLength":3,"\_unitId":1,"\_body":{"\_fc":4,"\_code":1}}}"  
> 7/30/2019, 4:47:56 PM[node: J10](http://192.168.0.35:1880/)msg : string[46]

"socket error: undefined: Locally emitted error"

i dont know what exat is problem. i also tried to read data of same device using other modbustcp utility and i get successful responce from same decvice.

---

<div class="post-metadata">

**Author:** ![ashish\_8284](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ashish_8284/32/3908_2.png) [@ashish\_8284](https://discourse.nodered.org/u/ashish_8284)\
**Post date:** [31 July 2019 12:36 UTC](https://discourse.nodered.org/t/help-to-read-data-using-modbus-tcp-protocol/13837/2 "2019-07-31T12:36:09Z")

</div>

Problem resolved. Actually modbus address in manual is like 30001 for holding rejister.  
But actually address is 1 & 3 represent function code.  
Now I am getting data.

Only need solution to swap words for energy consumption reading.
