# Read variable from OMRON

**URL:** <https://discourse.nodered.org/t/read-variable-from-omron/9727>\
**Category:** Industrial\
**Created:** [3 April 2019 11:51 UTC](https://discourse.nodered.org/t/read-variable-from-omron/9727 "2019-04-03T11:51:13Z")\
**Posts on this page:** 18\
**Page:** 3

<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 April 2019 15:04 UTC](https://discourse.nodered.org/t/read-variable-from-omron/9727/41 "2019-04-10T15:04:03Z")

</div>

Your flow is not copy / paste-able.

You need to re-add it between ```` three back ticks ````

---

<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 April 2019 15:15 UTC](https://discourse.nodered.org/t/read-variable-from-omron/9727/42 "2019-04-10T15:15:03Z")

</div>

One other thing to consider is the cable proven? Are you certain you are using correct PC COM port? Do you have a serial port logger/analyser to see if data is flowing through the port?

in the absence of a serial port logger, you can just try different things. e.g. change the settings in NR port configuration.

PS, not certain, but on some OMRON PLCs, there is a dip switch that forces the port to be TOOLBUS (i.e. ignores settings) - you may want to read the manual for CQM.

PS2: If you have made the cable yourself, OMRON pin 2 & 3 are swapped and SG is on pin 5 i think.

BTW: I hate serial ☹ If I was you & had budget, I'd swap this obsolete PLC for CJ2M PLC. It comes with oodles more memory, much faster processor AND built in Ethernet port with the EtherNet/IP and FINS protocol built in. Plus, you can simulate MODBUS TCP in ladder.

---

<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 April 2019 15:19 UTC](https://discourse.nodered.org/t/read-variable-from-omron/9727/43 "2019-04-10T15:19:22Z")

</div>

Although I cannot import your flow due to formatting issue, I did just notice a `\n` in there...

> [@hathemi](#):
>
> "waitfor":"","newline":"\n","bin":"false","out":"char","addchar":"\r",

I said ...

> [@Steve-Mcl](#):
>
> - Input
> - Split input - on the character: `\r`
> - and deliver: `ascii strings`
> - Output
> - Add character to output messages: `\r`

Did you set these?

Anyhow, you might be close - try changing settings in all areas and try try try again 🙂

Try using HEX equivelants instead of escape characters (e.g. replace `\r` for `0x13` in the serial config.

Try resetting PLC power after port changes.

Check the manual about dip switches.

Good luck.

---

<div class="post-metadata">

**Author:** ![hathemi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hathemi/32/3792_2.png) [@hathemi](https://discourse.nodered.org/u/hathemi)\
**Post date:** [10 April 2019 15:33 UTC](https://discourse.nodered.org/t/read-variable-from-omron/9727/44 "2019-04-10T15:33:01Z")

</div>

yeah you are absolutely right. my fault sorry ,i copied a wrong flow. i have set \r in input and output as you said and deliver ascii strings..  
i will follow your new instruction and i hope i will get a result..

---

<div class="post-metadata">

**Author:** ![hathemi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hathemi/32/3792_2.png) [@hathemi](https://discourse.nodered.org/u/hathemi)\
**Post date:** [10 April 2019 16:33 UTC](https://discourse.nodered.org/t/read-variable-from-omron/9727/45 "2019-04-10T16:33:06Z")

</div>

> [@Steve-Mcl](#):
>
> serial port logger/analyser to see if data is flowing through the port

here's what i got when onnecting plc to cx-programmer

 ![Sans%20titre](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/e/e8f15d04066342a1315bd63c21d3c3be30e083e7.png)  
but when i turned it on run operation and switch to NR i get nothing showing on Serial Port Monitoring

---

<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 April 2019 19:10 UTC](https://discourse.nodered.org/t/read-variable-from-omron/9727/46 "2019-04-10T19:10:48Z")

</div>

Are you seeing any Comms at all?

I can't really make head nor tail of that screenshot tbh. Do you see actual Comms data with CX connected?

And when you disconnect CX then start node red, do you see any Comms at all - In either direction? If not, perhaps the node-red comm port setup is NG?

I think I said earlier, I've never used serial nodes from node red.

---

<div class="post-metadata">

**Author:** ![hathemi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hathemi/32/3792_2.png) [@hathemi](https://discourse.nodered.org/u/hathemi)\
**Post date:** [10 April 2019 20:01 UTC](https://discourse.nodered.org/t/read-variable-from-omron/9727/47 "2019-04-10T20:01:40Z")

</div>

> [@Steve-Mcl](#):
>
> NG

sorry for my silly question what is the NG ?

---

<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 April 2019 21:11 UTC](https://discourse.nodered.org/t/read-variable-from-omron/9727/48 "2019-04-10T21:11:58Z")

</div>

Apologies. Common short hand for No Good.

---

<div class="post-metadata">

**Author:** ![hathemi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hathemi/32/3792_2.png) [@hathemi](https://discourse.nodered.org/u/hathemi)\
**Post date:** [12 April 2019 14:00 UTC](https://discourse.nodered.org/t/read-variable-from-omron/9727/49 "2019-04-12T14:00:34Z")

</div>

> [@Steve-Mcl](#):
>
> if you use the TXD function, what is in your control word

Hi again, What do you mean by control word, please ?

---

<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 April 2019 15:15 UTC](https://discourse.nodered.org/t/read-variable-from-omron/9727/50 "2019-04-12T15:15:03Z")

</div>

I'm not 100% certain but I'm pretty sure the TXD ladder logic function requires not only the source data to send but also a control word (kinda parameter for which com port to use)

Since you're asking about the TXD function then I suspect you are looking to use raw mode (e.g. rs-232c mode) **instead** of host link protocol?

When your com port is set for rs-232c mode you can use the TXD ladder function to send values from the PLC to the serial port without first requesting data from the PC side

Have a look in the CX help file at the TXD function. It's fairly straightforward.

once you have some ladder sending data by the TXD function you should see the com port indicator on the PLC begin the blink. This is a good clue that you have things working at the PLC side.

Hope that helps.

---

<div class="post-metadata">

**Author:** ![Rafacala](https://avatars.discourse-cdn.com/v4/letter/r/6f9a4e/32.png) [@Rafacala](https://discourse.nodered.org/u/Rafacala)\
**Post date:** [28 October 2020 06:51 UTC](https://discourse.nodered.org/t/read-variable-from-omron/9727/52 "2020-10-28T06:51:07Z")

</div>

Hello friends, I am new around here, I know that the post is old and perhaps no help is required, but it will be the little that I can help and contribute in this because I am just using it now, Omron have a useful tool to get the crc correctly, the serial communication used in this case is sysmacway, this tool can be very useful for tests in communications, series, fins, modbus and others like the ones in the post and surely it would have been very useful at the time.

 ![multiway](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/f/9f7a3103a73f3c1ec112b6e15301368cbcef8a44.png)

---

<div class="post-metadata">

**Author:** ![Rafacala](https://avatars.discourse-cdn.com/v4/letter/r/6f9a4e/32.png) [@Rafacala](https://discourse.nodered.org/u/Rafacala)\
**Post date:** [29 October 2020 01:03 UTC](https://discourse.nodered.org/t/read-variable-from-omron/9727/53 "2020-10-29T01:03:42Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/6/66b21a9854cb70657138c7d778a12cccc452d136.png)  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/0/10b49e3acc05ec960f479e7634c36ae463537bd3.png)  
i can with host link, need refresh port for news values, but I don't know how to do it, I'm new to node-red.

---

<div class="post-metadata">

**Author:** ![Rafacala](https://avatars.discourse-cdn.com/v4/letter/r/6f9a4e/32.png) [@Rafacala](https://discourse.nodered.org/u/Rafacala)\
**Post date:** [29 October 2020 01:05 UTC](https://discourse.nodered.org/t/read-variable-from-omron/9727/54 "2020-10-29T01:05:07Z")

</div>

Config with PLC at host link omron this PLC have an CJ1M-CPU11 conexion with the Peripherical port.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/8/78129f5c40669cecfffff2ecefad65efe1958c78.png)  
I have used different injection start times so that the input can return them 1 to 1  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/4/e43c890848d0e64ad9badf8d6727c32a98adb5e5.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:** [29 October 2020 09:51 UTC](https://discourse.nodered.org/t/read-variable-from-omron/9727/55 "2020-10-29T09:51:29Z")

</div>

What omron plc are you using? Is there an Ethernet port in it?

---

<div class="post-metadata">

**Author:** ![Rafacala](https://avatars.discourse-cdn.com/v4/letter/r/6f9a4e/32.png) [@Rafacala](https://discourse.nodered.org/u/Rafacala)\
**Post date:** [29 October 2020 12:11 UTC](https://discourse.nodered.org/t/read-variable-from-omron/9727/57 "2020-10-29T12:11:50Z")

</div>

no, this plc only have 2 ports fot host link, toolbus, rs232-c is one plc CJ1M-CPU11 of omron.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/4/64fd72b3c81e1036118d60d537b621946c118329.png) this model, have one peripherical port and one DB9 port.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/9/d9c3829323e942c45a412042bfbbadd80491ac65.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:** [29 October 2020 13:20 UTC](https://discourse.nodered.org/t/read-variable-from-omron/9727/58 "2020-10-29T13:20:45Z")

</div>

If you purchase and add an EIP21 or ETN21 then there is a contribution node in the flows library called OMRON FINS that works with CJ PLC's.

---

<div class="post-metadata">

**Author:** ![Rafacala](https://avatars.discourse-cdn.com/v4/letter/r/6f9a4e/32.png) [@Rafacala](https://discourse.nodered.org/u/Rafacala)\
**Post date:** [29 October 2020 13:35 UTC](https://discourse.nodered.org/t/read-variable-from-omron/9727/59 "2020-10-29T13:35:01Z")

</div>

Yes i see yesterday's, and can check the fins communication, but thx for the info.

---

<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:** [28 December 2020 13:35 UTC](https://discourse.nodered.org/t/read-variable-from-omron/9727/60 "2020-12-28T13:35:02Z")

</div>

Closed on 28 December 2020 13:35 UTC

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

[Previous page](https://discourse.nodered.org/t/read-variable-from-omron/9727.md?page=2)
