How to Copy an Array of Strings in SLC 5/05?

robertmee

Lifetime Supporting Member
Join Date
Feb 2008
Location
NC
Posts
1,990
I keep a Batch history in the SLC for the last 10 Batches. (I actually have multiple batching processes, but for now just concentrate on one).

I've constructed a Date/Time string easy enough. Now I want to shift if through 10 ST locations (420 words). I do this with all the other data pertinent to the batch but of course it is much easier with integers/floats. I simply do a COP of words 0-8 to a scratch pad, then copy those 0-8 back to 1-9 and move the newest value into word 0. I could do that with File shifts but it is easier for the technician to see what's going on.

Anyway, I went to do that with the string files and ran into the 128 word limit of the COP statement. Since each single string location (ST18:0 eg) is 42 words, it seems I can only do three at a time, which makes the psuedo shift very tedious. Any suggestions on doing this cleanly, 10 strings at a time. Bottom line, I want to shift strings 0 to 8 to 1 to 9 and update string 0 with the current date/time string that I created.
 
I am afraid that you will have to creat a loop (or series of COPies) in order to FIFO the strings.

The alternative, is to stop moving all that data and switch to a methodology in which you have a circular pointer which points to the latest data, and simply rolls over to zero after it increments from 9...

The former is probably the quick and dirty, but the circular file pointer may be the "cleanest" in the long run, depending on how much other stuff you have which refers to those elements.

The COP comand works on strings as if each element were a file, so (as you found) you quickly hit the limit.

EDIT: That statement isn't exactly right, but if your strings are long enough it is effectively the case...

Since ST files are two bytes per character, and each element can be 80 characters in length.

I use the COPy file command to copy one string element to another quite often, but have not tried to use it like a FIFO as I do often with Bits and Ints and Floats.

Paul
 
Last edited:
Thanks Paul....

I went ahead with the brute force method of three sets of COPs at 3 elements each. These elements are only linked to an HMI for a quick look at the last 10 batches, so I'm not sure how the pointer method would fit.
 

Similar Topics

I am having to manipulate MB data in a compactlogix 5380. I need to copy the bit array from the TCP MB master into a matching bit array to use in...
Replies
13
Views
2,499
All, i nto fully get it. I read trough some froums but not finaly make it running. so I try to ask. Hopefully anybody has the kindness to answers...
Replies
7
Views
1,187
Hello! I am completely new to PLCs, so I apologize in advance if this is a dumb question. I have a device that sends out its data as a number of...
Replies
5
Views
2,125
Gents, I have a DB, that is an array of a UDT. This UDT has got a combination of INT's and REAL's. When an action is completed, I want to move...
Replies
11
Views
4,209
I am using v14 with a 1215 dc/dc/dc. I need to copy a 50 element array of strings to another 50 element array of strings. I can work it out for...
Replies
3
Views
4,006
Back
Top Bottom