RSLogix 5000 Issue copying strings

wesselvos

Member
Join Date
May 2016
Location
Kaatsheuvel
Posts
21
Hiya,

For a machine im using a recipe that has 20 lines. Each line contains a free enter field for the customer to enter whatever into (String).

During testing i copy these values step by step into another array of the same exact size and make a printout of what has been dosed into the machine.
(As seen in the 4th attachment)

With a recipe for example i have the free enter field completely empty (or filled with 0's). After the machine has gone through this step i will copy the free enter field to a string and numbers seem to appear in it.

As seen in attachment 5.

Any idea on what im doing wrong?

Thanks!

recipe data type.jpg clear last batch description.jpg report data type.jpg copy rec string to report string.png random numbers.png
 
I am guessing that your GEN.DATA.STRING.EMPTY is a single empty string.

If so then, in your CPS instruction, after it copies the empty string into ...DESCRIPTION[0] it continues to copy whatever is in memory after the empty string into the other strings. It does not go back to the beginning of the empty string each time to copy it into the other 20 strings. Possible changes ...

1. Change your 'empty string' into an array of strings just like your description array but make sure they are empty.

2. Make a FOR/NEXT loop to copy the empty string into each of the description strings.

3. Use the FAL command to step through the strings and copy the empty string into them.

In the end you may want to consider making a UDT out of all the components of this information so it can all be copied or cleared as a unit.
 
Rather than filling the string with zeros just change the .LEN to 0

The COP or CPS instruction used the size of the destination element as the block of linear memory it copies. It then does a byte by byte copy into the destination with no regard to the structure of the destination. It looks like you have quite a complicated UDT for storing your information. Unless the block of strings you are copying into are defined as an array they may not be aligned in memory contiguously.

You can copy an array of dints into a UDT that has only one DINT in it and a bunch of strings afterwards. It will do it and smash the strings to bits. Pretty much the only thing that will stop it is trying to go outside the complete structure of the destination.

As bernie says, the safest way to easily use the COP instruction to do this is to use the same UDT for source and destination.
 
I am guessing that your GEN.DATA.STRING.EMPTY is a single empty string.

If so then, in your CPS instruction, after it copies the empty string into ...DESCRIPTION[0] it continues to copy whatever is in memory after the empty string into the other strings. It does not go back to the beginning of the empty string each time to copy it into the other 20 strings. Possible changes ...

1. Change your 'empty string' into an array of strings just like your description array but make sure they are empty.

2. Make a FOR/NEXT loop to copy the empty string into each of the description strings.

3. Use the FAL command to step through the strings and copy the empty string into them.

In the end you may want to consider making a UDT out of all the components of this information so it can all be copied or cleared as a unit.

That actually make good sense, appears those random numbers weren't so random.

Ill figure it out thanks to both of yours help :)
 
Last edited:

Similar Topics

Hi ,I'm new to plc programming I have old controllogix plc with 1756-l55M12 controller I downloaded trial version of rslogix 5000 v16 I was able...
Replies
5
Views
1,611
Hello all, I have a weird problem in rslogix 5000. Few of rungs the instruction shows UNK. I have the attached the screenshot of the program. I...
Replies
15
Views
8,068
Hi, Recently i bought rslogix 5000 v30 Professional software. i downloaded and installed in windows 10 pro. Installed and activated successfully...
Replies
2
Views
2,829
Hello everybody, Today, when I install Rslogix 5000 v20 on fresh Win7 32 bit, it showed me a message " Unable to cofigure the FactoryTalk Network...
Replies
4
Views
2,406
hi, i know how to write program in rslogix 500. in youtube video of rslogix 5000 programming i saw that they are just writing character tags (like...
Replies
3
Views
2,015
Back
Top Bottom