G_DeMark

Logix 5000 Scan Cycle

8 posts in this topic

   I have a fundamental question regarding the scan cycle and timing of the Logix 5000 platform.  I have attached a very simple ladder rung for reference.  In this fictitious rung I would like to make sure that the CPT instruction finishes prior to the execution of the COP instruction.  How do I make sure of this?  Is it enough to simply put the COP instruction after the CPT?  I am worried that if the CPT was complex it may take too long and finish the calculation after the COP executed.  In that case I would not have copied the latest value into TAG 'B'.  What are your thoughts?

Thanks and Regards

Capture10.JPG

Share this post


Link to post
Share on other sites

I'd put the copy "downstream" on the same rung as the compute. 2 branches compute then copy in other words

Share this post


Link to post
Share on other sites

What you have looks good to me.  My understanding is that the Logix scans left to right, top to bottom.  Only the I/O updates are asynchronous.  Somebody let me know if I'm wrong on that one!  You could alternatively put all three instructions you have in series.  I still cant get past too many years putting them in branches like you have. 

Share this post


Link to post
Share on other sites

Generally speaking, Rockwell controller execute from left to right, then top to bottom.

I do caution you that not all function blocks execute in one scan of the code.  Specifically, the COP.  Having gone round and round with RA Tech Support, eventually deciding to use the CPS rather than COP.  Not as important for your example as there is little to copy.  More important when copying large arrays or UDTs.

 

Edited by pcmccartney1

Share this post


Link to post
Share on other sites

Yes, I am still uncomfortable putting output instructions in series.  However, it seems like a good solution in this case.

Share this post


Link to post
Share on other sites

Interesting.  My understanding is the only time you have to worry about the COP statement is when you are copying information that might change during the execution of the statement.  That should be limited to I/O, produced consumed data and data that might change due to a periodic task interrupt.  Those would all be instances where data might change during the instruction execution, but should not be affected by placement of the statement in the program.

Share this post


Link to post
Share on other sites
1 hour ago, PLCMentor.com said:

Interesting.  My understanding is the only time you have to worry about the COP statement is when you are copying information that might change during the execution of the statement.  That should be limited to I/O, produced consumed data and data that might change due to a periodic task interrupt.  Those would all be instances where data might change during the instruction execution, but should not be affected by placement of the statement in the program.

This is the correct answer.

In spite of all the 32-bit architecture, the COP instruction moves data one byte at a time, and can be interrupted between any two bytes. CPS cannot be interrupted.

 

Share this post


Link to post
Share on other sites
Quote

In this fictitious rung I would like to make sure that the CPT instruction finishes prior to the execution of the COP instruction

...

I am worried that if the CPT was complex it may take too long and finish the calculation after the COP executed.  

Considering the OP's original post and focusing on the words "I would like to make sure" I still think, especially since it's simple to do, that the copy should be in line with the compute.

However, I would add that, if the computation is so long that timing could be a problem, why not create a structured text function for the computation with an assignment on the last line (tag := result;)

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