How to do a MOV with a ST file in RSLogix500

rta53

Lifetime Supporting Member
Join Date
Feb 2003
Location
North Carolina
Posts
619
I constructed a string file which displays Hours:Minutes:Seconds and would like to be able to MOV or COP this file multiple times to other string files. I used a COP instruction for the first one and it worked fine. For example:

Copy File
Source #ST18:7
Destination #ST18:8
Length 1

Fine so far. But what if I wanted to copy from ST18:7 to ST:9? I wasn't sure how to skip over ST18:8.

I tried to use a MOV instruction but can't figure out how to do it. I have 8 characters in my string file. What syntax do I use to move all 8 characters. I read the manual but still don't understand it.

Here is my ST18 data file:

string.jpg
 
Does:
Copy File
Source #ST18:7
Destination #ST18:9
Length 1

Not work?

I don't usually use string files, but you are still copying one element from source ST18:7 to the destination of ST18:whatever, no?
 
MOV v. COP and STring data types

In the SLC, the MOV instruction is only good for one word of data.

It doesn't matter if that word is the .ACC word of the 3-word element T4:0, or the whole of an N15:6, or the group of bits in B16:0.

An ST element is an 42-word element. So, if using a MOV on a ST, you could copy over just the string lenght (MOV ST18:9.LEN) or any 2-character pair of the string (MOV ST18:9.DATA(3)).

But if you want to keep the entire 42-word element grouped together, then you need the COP instruction.

The COP length isn't by word, but by element (which will vary in the number of words transferred, depending on the data type of the destination. So a COP ST18:7 ST18:9 will copy all 42 words (the length word, and 41 2-character pairs) from one string structure to another.

Now to your question
"But what if I wanted to copy from ST18:7 to ST:9?

<snip>

I have 8 characters in my string file. What syntax do I use to move all 8 characters?
"

I'm not clear on exactly what you are asking. You might be confusing the string data file (ST:18:7, ST18:8, ST18:9), with a string element's structure (ST18:7.DATA[3], ST18.7.DATA[4].

Each element in an ST contains a complete string (in your case, might contain the string "12:34:45".
The value of ST18:7.LEN is 8.
The value of STS8:7.DATA[0] is "12" (or 12594, if you could view those 16 bits as an integer.)
The value of STS8:7.DATA[1] is ":3"
The value of STS8:7.DATA[2] is "4:"
The value of STS8:7.DATA[3] is "56"

Now, if you are trying to just copy the "12:34" without copying the "56", you should use the ASCII functions like AEX to manipulate your string.



It's also possible that you have time information in ST18:1, ST18:2, through ST18:7 (and also ST18:9), and you want to transfer that data to some other location (ex: ST42:0 through 7). For this, you would use the COP instruction, (COP #ST18:1 #ST42:0 7). The length of 7 will move ST18:1 through ST18:7 to ST42:0 through ST42:6. To get the data in ST18:9 into ST42:7, you would need a seperate COP command, with a lenght of 1.

Does any of this clear things up for you?


When I first started replying, the picture wasn't there for some reason. So some of reply may not be quite right.
 
Last edited:
Does:
Copy File
Source #ST18:7
Destination #ST18:9
Length 1

Not work?

Must have been doing something wrong before because it works now.

Allen, thanks for your detailed reply. I guess I was trying to figure out a way to move just the words containing the H:M:S and not all 42, but hopefully I won't run into any memory shortage. I will only be doing the COP with the string elements about 12 times and my program is not that large.

Thanks
 

Similar Topics

I am using a SLC 5/04 with a AST3301 Proface touchscreen. I am using 500 software. I have recipes stored in the Nxx:x file. I have names of the...
Replies
6
Views
2,325
Hello experts. Anyone has any idea how to make BLKMOV execute only once? I have tried with R_TRIG and (P) but it wont write to my location.
Replies
3
Views
193
I've used AOI and User Defined Data Types, but I haven't created one yet. I have a lot of repetitive MOV commands to take a select number of...
Replies
4
Views
374
I'm having to make an AOI to use with a generic ethernet device because the manufacturer does not provide an AOP. I just want to do a sanity check...
Replies
13
Views
1,250
Hello, I'm trying to copy the entire value of a UDT base tag to an element of an array of another UDT containing an element of the first UDT...
Replies
7
Views
1,657
Back
Top Bottom