# HELP ! Reading data from a PLC through Modbus TCP

**URL:** <https://discourse.nodered.org/t/help-reading-data-from-a-plc-through-modbus-tcp/28752>\
**Category:** Industrial\
**Created:** [22 June 2020 19:22 UTC](https://discourse.nodered.org/t/help-reading-data-from-a-plc-through-modbus-tcp/28752 "2020-06-22T19:22:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![C0RT3X](https://avatars.discourse-cdn.com/v4/letter/c/f475e1/32.png) [@C0RT3X](https://discourse.nodered.org/u/C0RT3X)\
**Post date:** [22 June 2020 19:22 UTC](https://discourse.nodered.org/t/help-reading-data-from-a-plc-through-modbus-tcp/28752/1 "2020-06-22T19:22:38Z")

</div>

Hi everyone !  
I am working on a project for my thesis and a part of this one is to displays the data received from the sensors on the graphical interface using the red node.  
I have successfully built the project for PLC and it works, but I can't read this that through the modbus and display them. The project was built in Ecostruxure SOMachine HVAC.  
When I am trying to connect to my PLC I displays and error that says "sequential dequeue command not possible".  
Could someone help me to solve this ?  
I will leave some screenshots with the settings.

 ![Node Red Connection Settings](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/f/3f1757f017d19ecab88eb17390b786a6811a45f3.png) ![SoMachine Settings](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/5/e5e28e6b4dde238d4cab7d7cf5496a88f1abf668.png)

Thank you in advance for any help.  
I'll provide more info if anyone needs it.

P.S. Used PLC - Modicon TM172PDG18R  
P.S.S. When I write address 8960 it retrieving me this response but I don't really know what kind of data are this.

```auto
23.06.2020, 03:51:43[node: c072310d.48e5b](http://192.168.1.104:1880/#)msg.payload : Object

object

data: array[4]

0: 0

1: 0

2: 220

3: 100

buffer: buffer[8][raw](http://192.168.1.104:1880/#)

0: 0x0

1: 0x0

2: 0x0

3: 0x0

4: 0x0

5: 0xdc

6: 0x0

7: 0x64

```

8960 is the address of a status variable, when I try for another address it displays:

```auto
 "Error: Modbus exception 2: Illegal data address (register not supported by device)"
"TypeError: Cannot read property 'status' of undefined"

```

---

<div class="post-metadata">

**Author:** ![C0RT3X](https://avatars.discourse-cdn.com/v4/letter/c/f475e1/32.png) [@C0RT3X](https://discourse.nodered.org/u/C0RT3X)\
**Post date:** [23 June 2020 22:53 UTC](https://discourse.nodered.org/t/help-reading-data-from-a-plc-through-modbus-tcp/28752/2 "2020-06-23T22:53:52Z")

</div>

I have found how to export the modbus addresses for my objects and those looks like this:

```auto
408960
408961
408962
408963
408964

```

But when I put them in address field it says

```auto
"RangeError: The value of "value" is out of range. It must be >= 0 and <= 65535. Received 408960"

```

I think that I have to format them... Could someone help me to understand what to do with this addresses ?

---

<div class="post-metadata">

**Author:** ![seth350](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/seth350/32/4617_2.png) [@seth350](https://discourse.nodered.org/u/seth350)\
**Post date:** [24 June 2020 02:01 UTC](https://discourse.nodered.org/t/help-reading-data-from-a-plc-through-modbus-tcp/28752/3 "2020-06-24T02:01:20Z")

</div>

First, allow me to say that this is a great subject for a thesis. I’ve never done one, but it seems fitting.

Second, you picked one of the most non-standard “standard” methods of communication between devices.

Very few manufacturers follow the golden standard and sadly it is left up to the individual to figure out which addresses give the correct results.

Looking at your screenshots, it appears the node is setup correctly. The PLC matches your node configuration. The one thing that sticks out is the FC-03\_1 element below your modbus driver.

I never have used the M172 PLC, but first impressions are that the driver allows you to add function codes as required to the driver. Within that function code element, I would imagine that there is some variable mapping allowing you to tie a variable to a modbus address.

Also, what is the offset required for the address?  
Normally it is 40001 for holding registers but check the manual for the PLC.  
Also, those addresses you posted look one digit too long. Verify you have the correct address and take a screenshot of the FC-03\_1 configuration.

---

<div class="post-metadata">

**Author:** ![C0RT3X](https://avatars.discourse-cdn.com/v4/letter/c/f475e1/32.png) [@C0RT3X](https://discourse.nodered.org/u/C0RT3X)\
**Post date:** [24 June 2020 08:59 UTC](https://discourse.nodered.org/t/help-reading-data-from-a-plc-through-modbus-tcp/28752/4 "2020-06-24T08:59:48Z")

</div>

Thank you for your response !

 ![Node Red Settings](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/c/3c82c566ff18c5a4641db3a02005ccb83377abef.png)  
 ![SoMachine Settings 2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/a/0ad290e5e05a23da44364020579114f95e72bf45.png)

I have remove the node from SoMachine that is related to Ethernet -\> Generic Modbus because I didn't find any sense in this.  
I didn't find the required offset in manual 😕  
Here is all the guides/manual for this device. Maybe you will to find the offset that I didn't find: [https://www.se.com/ww/en/product/TM172PDG18R/modicon-m172-performance-display-18-i-os%2C-ethernet%2C-modbus/](https://www.se.com/ww/en/product/TM172PDG18R/modicon-m172-performance-display-18-i-os%2C-ethernet%2C-modbus/)

---

<div class="post-metadata">

**Author:** ![C0RT3X](https://avatars.discourse-cdn.com/v4/letter/c/f475e1/32.png) [@C0RT3X](https://discourse.nodered.org/u/C0RT3X)\
**Post date:** [24 June 2020 11:19 UTC](https://discourse.nodered.org/t/help-reading-data-from-a-plc-through-modbus-tcp/28752/5 "2020-06-24T11:19:11Z")

</div>

I have found that address = address - offest, so if the address 8960, I should read 8959 but the problem is that it's reading right only the EEPROM Parameters like Delta and Setpoint.  
When I am trying to read analog input values that are declared as Status Variables it displays the default values of this.

 ![NodeResponse](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/c/1c2f5a7bb5e5be98ce444cec5f33e130a8973e58.png) ![SoMachine](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/5/f535b23d2a29d608d9025bb8ad632524a18e5a6f.png)

---

<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:** [23 August 2020 11:19 UTC](https://discourse.nodered.org/t/help-reading-data-from-a-plc-through-modbus-tcp/28752/6 "2020-08-23T11:19:16Z")

</div>

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