Nickr6

How to move an Array ? (CompactLogix)

8 posts in this topic

hello!

I create many Array (DINT[13])  to memorize the recipe data. 

I need to move the entire content of the Array to another Array of the same type ( both are DINT(13) )

Do I really need to move only one data at the time like : 

mov Rrp1_close_time(0) to in_use_close_time(0)

mov Rcp_close_time(1) to in_use_close_time(1)

.........

 

Thanks for looking :-)

Share this post


Link to post
Share on other sites

The CLX Instruction list is pretty handy. I don't have access to it right now but I think the Copy instruction is what you are looking for. CPY if I'm not mistaken

Share this post


Link to post
Share on other sites

the copy  (COP)  instruction only works if I move  one DINT  :   COP  Rrp1_close_time(0) to in_use_close_time(0)

but if I try : COP  Rrp1_close_time  TO  in_use_close_time     =  I get an error.

 

 

Share this post


Link to post
Share on other sites

Create a UDT of all the items in the recipe. Then create an array of that UDT type. Then the copy can be used to move entire recipes as a unit.

1 person likes this

Share this post


Link to post
Share on other sites
39 minutes ago, Nickr6 said:

the copy  (COP)  instruction only works if I move  one DINT  :   COP  Rrp1_close_time(0) to in_use_close_time(0)

but if I try : COP  Rrp1_close_time  TO  in_use_close_time     =  I get an error.

I'm not able to test and it's been a while since I used it but Copy has source, destination, and length. Length is the number of destination elements to copy.

 

 

1 person likes this

Share this post


Link to post
Share on other sites

:-2  exactly what I need  b_carlton ,  Thanks!!!!

 

exactly Michael Lloyd but even if I specify the length the COPY fonction dont works

Share this post


Link to post
Share on other sites

The COP instruction is the correct instruction for this.  You were on the right track with Array1[0] to Array2[0].  You just need to put in the number of elements to copy as the length.  You cant leave off the [0]  part as the starting location.  Array1 is not a valid location  - Array1[0] is.

2 people like this

Share this post


Link to post
Share on other sites
29 minutes ago, PLCMentor.com said:

The COP instruction is the correct instruction for this.  You were on the right track with Array1[0] to Array2[0].  You just need to put in the number of elements to copy as the length.  You cant leave off the [0]  part as the starting location.  Array1 is not a valid location  - Array1[0] is.

Ohh! I see my mistake.

thanks :-)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now