I have a set of memory tags(string) that I concate together to form string sent to the PLC. The format shows correctly except for the last memory tag which I have a value of :STAR $r$1, but shows in the PLC as :STAR $$r$$1. Is there some format that I have incorrectly. This is controllogix PLC.
$ is what is known as an escape character in the Rockwell world. so It is literally trying to give you a dollar sign in your PLC string ($$ is for the dollar sign). You will need something similar from Igniiton.
There’s part of me that thinks that it should be $R$L as that is a standard carriage return / line feed sequence.
try placing it with \r\n in your Ignition string.
$R$L is correct. With \r\n, it gives me \r\n in the PLC.
Are these from expressions, then? You may have to script it together, as I don’t think there is any provision for control characters in expression language.
Yes, I am thinking that’s what I will have to do.
The string is made of several strings put together based on settings. The last section of the string is always :STAR $r$l, so I just made that a constant value in the PLC and concate that in the PLC itself to the rest of the string that I was combining in Ignition. Just an extra step, but it works. This was originally all done in the PLC, but I am using the Recipe Module and wanted to take advantage of it versus keeping all the setpoints in the PLC. Thanks for the help.
I was able to take a closer look this morning, and test it out on my bench, if you ever want to revisit it.
I could set up a script to add the CRLF and write it to a tag.
def addCRLF(stringIn): return str(stringIn) + '\r\n'
On a text field property change:
Write to a tag
if event.propertyName == 'text': output = hci.string.addCRLF(event.newValue) system.tag.writeBlocking(['[default]Test/Recipe/tagOut'],[output])
Write to opc
if event.propertyName == 'text': output = hci.string.addCRLF(event.newValue) server = 'IgnitionOPCUA' path = '[Jordan CLogix]Program:StringTest.StringIn' system.opc.writeValue(server, path, output)
That looks great. I may have to try that after we get the initial testing done with the system. Thanks.