Unequal string copy

bernie_carlton

Lifetime Supporting Member + Moderator
Join Date
Apr 2002
Location
Yakima, Washington
Posts
6,412
I'm using Compactlogix and RSLogix5000.

The external equipment vendor has a defined string shorter than the standard one (64 character versus 82 characters).

If a COPY is done from a shorter string to a standard string the last 18 characters of the standard string will probably end up as garbage.

Do subsequent string commands look at characters beyond those defined by the .LEN value or should I specifically null out the last 18 characters of the standard string just to be sure?
 
According to TN 50650 Custom STRING data types and copy to/from standard STRING tags (Access Level TechConnect) is possible to copy characters back and forth.

However, you're right about the garbage at the end of the string. I did a little test on Emulate and the COP instruction doesn't clear the longer string before copying the data from the shorter one. If you inspect the DATA array you will see some garbage at the end.

I think you can copy an empty string to your destination strings before executing another COP instructions involving short strings.
 
Actually I've decided to COPY an 18 element SINT array (all set to 0) into the final 18 character positions immediately after the string copy. It's only one place in the program so fine.

The 'garbage' would be whatever is in the 18 SINTs (4 1/2 DINTS - whatever) following the shorter string in memory.

And thanks for the Knowledgebase pointer. But copying an empty string in BEFORE the short -> standard copy is rather useless. The cleanup has to occur AFTER the string copy.
 
Last edited:

Similar Topics

I am creating a global object in FTView SE 13. I want to have a string read from the PLC and display (in this case the tagname). So lets say...
Replies
4
Views
137
So I had an odd request from a customer for the above. I have written the logic and tested it all in one PLC with only using 7 outputs and 7...
Replies
15
Views
402
Hello Inside a FB, I´m trying to transfer a string from a DB to a IN_OUT var that was define as a UDT. The problem is that i can´t determine the...
Replies
4
Views
120
As the title says, I'm using CCW with a PV800 (and Micro850). I've made a scheduler in which a user can choose a month, day (1-31), hour (0-23)...
Replies
15
Views
492
Hello, So i managed to read the string coming from control logix and put a string display in PanelView 800. Now I am struggling to do the other...
Replies
1
Views
133
Back
Top Bottom