# Node-red-contrib-mcprotocol quality "bad" on some write requests

**URL:** https://discourse.nodered.org/t/node-red-contrib-mcprotocol-quality-bad-on-some-write-requests/73446
**Category:** General
**Created:** [10 January 2023 08:13 UTC](https://discourse.nodered.org/t/node-red-contrib-mcprotocol-quality-bad-on-some-write-requests/73446 "2023-01-10T08:13:01Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![Mdahl96](https://avatars.discourse-cdn.com/v4/letter/m/ecae2f/32.png) [@Mdahl96](https://discourse.nodered.org/u/Mdahl96)
#### Post date: [10 January 2023 08:13 UTC](https://discourse.nodered.org/t/node-red-contrib-mcprotocol-quality-bad-on-some-write-requests/73446/1 "2023-01-10T08:13:01Z")

</div>

Hello, i have succeeded with pulling data from "Nordpool" and send it to an Array of 48 reals in my Mitsubishi PLC, but it's a 50/50 if the request returns a "good" or "bad" quality, it does write the data every time, but I would like to know why it returns "bad" quality sometimes.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/2/92f7857e4aa23d21f801830706672db43df3f82c.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/7/076eb9b0802c369c50a4db3b4618ca7ba160ee99.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: [10 January 2023 08:59 UTC](https://discourse.nodered.org/t/node-red-contrib-mcprotocol-quality-bad-on-some-write-requests/73446/2 "2023-01-10T08:59:10Z")

</div>

How fast are you hitting the PLC?

Are there multiple READ and / or WRITE MC Protocol nodes in operation at the same time?

Are the PLC and Node-RED on same network range or is there routing involved? (curious as to why you are using a 162 public IP address)

Are you monitoring the PLC at the same time with the ladder program? If memory serves me, port 5001 is the same port the programming tool uses. Maybe you could use a dedicated port number as setup on the "Open Settings" of the Ethernet card?

---

<div class="post-metadata">

### Author: ![Mdahl96](https://avatars.discourse-cdn.com/v4/letter/m/ecae2f/32.png) [@Mdahl96](https://discourse.nodered.org/u/Mdahl96)
#### Post date: [10 January 2023 09:09 UTC](https://discourse.nodered.org/t/node-red-contrib-mcprotocol-quality-bad-on-some-write-requests/73446/3 "2023-01-10T09:09:09Z")

</div>

Hello, thanks for the fast reply.

There is only this one write request and no read requests.  
i'm doing a new request every 30 seconds

this is a test setup, so just a network cable from the PLC, the Node Red and my computer in a common switch.

I am connected with a USB cable from my computer to the PLC to make sure it wasn't the monitoring connection that slowed it down. and i also tried disconnecting the plc software and it still happens.

all code is made in FB and ST 😃

PLC IP: 162.0.9.21  
Node Red IP: 162.0.9.6  
PC IP: 162.0.9.19

---

<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: [10 January 2023 09:15 UTC](https://discourse.nodered.org/t/node-red-contrib-mcprotocol-quality-bad-on-some-write-requests/73446/4 "2023-01-10T09:15:51Z")

</div>

Is the PLC running a large program or have high cycle times (What is the PLC scan time)?

Could you try a different port?

Also, could you share your flow (use CTRL-E to export & use the forums code button `</>` before pasting into the reply)

---

<div class="post-metadata">

### Author: ![Mdahl96](https://avatars.discourse-cdn.com/v4/letter/m/ecae2f/32.png) [@Mdahl96](https://discourse.nodered.org/u/Mdahl96)
#### Post date: [10 January 2023 09:27 UTC](https://discourse.nodered.org/t/node-red-contrib-mcprotocol-quality-bad-on-some-write-requests/73446/5 "2023-01-10T09:27:40Z")

</div>

```auto
[{"id":"54378ae8.967044","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"845fa91e.57e518","type":"nordpool-api","z":"54378ae8.967044","area":"DK1","currency":"DKK","timeSpan":"hourly","x":355.6666946411133,"y":256.0000162124634,"wires":[["76afda24.047224"]]},{"id":"a5682d2a.30792","type":"inject","z":"54378ae8.967044","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"30","crontab":"","once":false,"onceDelay":0.1,"x":172.66669082641602,"y":256.0000886917114,"wires":[["845fa91e.57e518"]]},{"id":"dd884d62.6e02a","type":"MC Write","z":"54378ae8.967044","name":"Mitsubishi PLC","topic":"","connection":"7fb7e572.9e27fc","data":"prices","address":"DREAL1112,48","addressType":"str","dataType":"msg","errorHandling":"msg","outputs":1,"x":793.6666870117188,"y":256.3333406448364,"wires":[["a8cbc3ad.739e6"]]},{"id":"a8cbc3ad.739e6","type":"debug","z":"54378ae8.967044","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1011.6667747497559,"y":256.3333406448364,"wires":[]},{"id":"76afda24.047224","type":"function","z":"54378ae8.967044","name":"Conversion","func":"var dataObj = { prices: [] }\n for (var i = 0; i < msg.payload.length; i++) {\n dataObj.prices.push(msg.payload[i].Price);\n }\n node.send(dataObj);\nreturn;","outputs":1,"noerr":0,"x":563.0000152587891,"y":256.0000104904175,"wires":[["dd884d62.6e02a"]]},{"id":"7fb7e572.9e27fc","type":"MC Protocol Connection","z":"","name":"Lendum Vandværk","host":"162.0.9.21","port":"5001","protocol":"UDP","frame":"4E","plcType":"Q","ascii":false,"PLCStation":"0x0","PCStation":"1","PLCModuleNo":"03xff","network":"1","octalInputOutput":false,"timeout":"10000"}]

```

---

<div class="post-metadata">

### Author: ![Mdahl96](https://avatars.discourse-cdn.com/v4/letter/m/ecae2f/32.png) [@Mdahl96](https://discourse.nodered.org/u/Mdahl96)
#### Post date: [10 January 2023 09:28 UTC](https://discourse.nodered.org/t/node-red-contrib-mcprotocol-quality-bad-on-some-write-requests/73446/6 "2023-01-10T09:28:50Z")

</div>

also Scantime seems to be \<1 ms.  
i am not dedicated Mitsubishi PLC user, but ill see if i can figure out how to change the port, got a colleague who is better at this stuff 😃

---

<div class="post-metadata">

### Author: ![Mdahl96](https://avatars.discourse-cdn.com/v4/letter/m/ecae2f/32.png) [@Mdahl96](https://discourse.nodered.org/u/Mdahl96)
#### Post date: [10 January 2023 09:45 UTC](https://discourse.nodered.org/t/node-red-contrib-mcprotocol-quality-bad-on-some-write-requests/73446/7 "2023-01-10T09:45:58Z")

</div>

same issue on port 5000 but i don't know if this is used by default aswell

---

<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: [10 January 2023 10:25 UTC](https://discourse.nodered.org/t/node-red-contrib-mcprotocol-quality-bad-on-some-write-requests/73446/8 "2023-01-10T10:25:55Z")

</div>

Yes, I think 5000 & 5001 are built-in ports for TCP and UDP. I forget because they changed over the years and A, QnA, Q, series.

Try ports \>= 3000 - they worked for me.

See this detail heavy reply...

> [@Mitsubishi Q Series Node Red Help](https://discourse.nodered.org/t/mitsubishi-q-series-node-red-help/33337/5):
>
> Here is a working example... Note the UDP MC Protocol + Port Number... NOTE: As with many things mitsubishi, you might need to power off/on the PLC for the settings change to take effect. Lastly, regarding reading data from mc protocol... We tend to arrange ladder to put all items of interest in one contiguous data block (e.g. D1000~D1199) then read all 200 WORDS in one go Then I use another node called [buffer-parser](https://flows.nodered.org/node/node-red-contrib-buffer-parser) to convert all the WORD values into nice data…

---

<div class="post-metadata">

### Author: ![Mdahl96](https://avatars.discourse-cdn.com/v4/letter/m/ecae2f/32.png) [@Mdahl96](https://discourse.nodered.org/u/Mdahl96)
#### Post date: [12 January 2023 15:53 UTC](https://discourse.nodered.org/t/node-red-contrib-mcprotocol-quality-bad-on-some-write-requests/73446/9 "2023-01-12T15:53:13Z")

</div>

Sorry for the late reply, other tasks called 😃

I now have connection on Port 3002 on the QJ71E71-100 ethernet card.

it also was running for a few hours without a single error, and suddenly the connection crashed and could not write any values to the PLC until I reset the PLC then it worked again for a short time. I cant imagine it being "overloaded" with this little data, witch was send with a 10 seconds interval.

---

<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: [12 January 2023 16:42 UTC](https://discourse.nodered.org/t/node-red-contrib-mcprotocol-quality-bad-on-some-write-requests/73446/10 "2023-01-12T16:42:01Z")

</div>

> [@Mdahl96](#):
>
> I now have connection on Port 3002 on the QJ71E71-100 ethernet card.

TCP or UDP?

Show me the "open" setup

---

<div class="post-metadata">

### Author: ![Mdahl96](https://avatars.discourse-cdn.com/v4/letter/m/ecae2f/32.png) [@Mdahl96](https://discourse.nodered.org/u/Mdahl96)
#### Post date: [12 January 2023 17:01 UTC](https://discourse.nodered.org/t/node-red-contrib-mcprotocol-quality-bad-on-some-write-requests/73446/11 "2023-01-12T17:01:11Z")

</div>

it's a UDP connection.

The port is not opened directly in the "Open" settings, but by a "FB".

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/7/47578c22fbefe0df1e5a77b84b77c3683241ae80.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/c/0c9d712e7a16e6b6ab1710a83cf6cd0fe8258fb4.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: [12 January 2023 17:20 UTC](https://discourse.nodered.org/t/node-red-contrib-mcprotocol-quality-bad-on-some-write-requests/73446/12 "2023-01-12T17:20:49Z")

</div>

Never had much success with ladder defined ports. Also always completely avoid structured ladder projects for mitsi Q (it is horrid) oh and if you have the choice, dump mitsubishi altogether - OMRON C series are far superior (imo) and cx-programmer is many many many miles ahead of gx in terms of usability and quality

Anyhow...

You will need to inspect the head buffer values for that card when the connection fails and cross-reference them with the manual for that card.

You might also get some clues from GX developer "ethernet diagnostics"

I will point out that, as you have witnessed, restarting the PLC is the only solution, so this particular issue you are seeing is probably a hardware thing. Did you try sending a disconnect/connect msg to the node to see if the connection recovered?

Lastly what settings are you using on the config node?

---

<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: [13 March 2023 17:20 UTC](https://discourse.nodered.org/t/node-red-contrib-mcprotocol-quality-bad-on-some-write-requests/73446/13 "2023-03-13T17:20:54Z")

</div>

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