Copy and Fill zero

bornwild

Member
Join Date
May 2010
Location
Riyadh
Posts
429
Hello all,

I have a basic question. I have an conveyor application where i need to copy data from location to another and then fill the previous location with zero. I see the program and i find copy and fll command are in the parellel and not in series . Will this cause a problem . I have the screen shot for better understanding.Waitng for the feedback

copy and move.JPG
 
Left to right and top to bottom. That is the order of execution for A/B PLCs. So the COP will always complete before the FLL in your screenshot. The only difference between having them in series versus parallel are the extra instructions for the branching. In a case like yours, I will make readability a priority over saving a couple of microseconds of scan time, so if it is more readable with the branch, keep it that way.
 
The reason I am asking is sometimes I see the data gets fll 0 before copying the data. I dont know if it from the program or problem lies some where else
 
We'd have to know more about 2 things: 1. The conditions preceding the execution of those two instructions. 2. The logic in control of the subscripts of the arrays they operate on.

It might be possible in a multitasking PLC for some other code to run in between the operation of those two instruction, but it should not be possible for the FLL to operate before the COP (during a single scan).
 
Or use a CPS instead of a COP
This is only relevant if you're copying data from an I/O device that's being scanned asynchronously. It will not have any effect on the execution of instructions on a rung, other than making them take much longer.
 
Ahh because the PLC isn't going to run an FFL in the middle of the COP instruction... it's ONLY the IO scan that can update asynchronously from the CPU scan? Ok that makes sense. Thanks!
 
This is only relevant if you're copying data from an I/O device that's being scanned asynchronously. It will not have any effect on the execution of instructions on a rung, other than making them take much longer.
I don't think that is the only case. The CPS is also relevant over a COP instruction if a higher priority task altering or using that data is executed in the midst of the COP instruction's execution. Saw a system where that happened once.
 
I don't think that is the only case. The CPS is also relevant over a COP instruction if a higher priority task altering or using that data is executed in the midst of the COP instruction's execution. Saw a system where that happened once.
Quite right - this is also possible. For the purposes that the OP has described, that possibility is not relevant though - changing from a COP to a CPS will have no effect on the sequence of the FFL/Copy execution.



Ahh because the PLC isn't going to run an FFL in the middle of the COP instruction... it's ONLY the IO scan that can update asynchronously from the CPU scan? Ok that makes sense. Thanks!
That's right - or, as RonJohn correctly pointed out, it's possible for a higher priority task to interrupt a COP halfway through. If that higher priority task does anything to the data being copied, then it's possible that the first half of the COP instruction will be acting on one data set, and the second half of the COP instruction (when it resumes after the interruption) will be acting on a different data set, which could have unpredictable results. A CPS instruction not only blocks I/O updates, but it also blocks higher priority tasks until it's done copying and protects against both those scenarios. But, when we're talking about the execution of two instructions in the same routine, as OkiePC said, it's always left to right, top to bottom, one rung after the other.
 
You could add a "EQU" in front of the "FLL" so that it won't execute the "FLL" until the source and destination files are the same I.E. its copied from one to the other.
 
The reason I am asking is sometimes I see the data gets fll 0 before copying the data. I dont know if it from the program or problem lies some where else

Basic question...
How do you "see" this situation? If you are talking about seeing the data populate online in Logix, that isn't reliable. Screen updates are not real time. If the correct data is copied, you don't have a problem. If the copied data is getting partially zeroed out, that's an real issue and code you haven't shown us yet is doing it.

More info please.
 
On the CPS vs COP discussion...

Yes, it is possible for a COP to be interrupted by a higher priority task. It is important that we are aware of that. However, we should also be careful about using CPS just because "something might happen". A lot of CPS (or even a single CPS with a large tag) can wreak havoc on other tasks by preventing them from running when they were supposed to.

Take the time to verify if any other code that can write to the tag and take the necessary precautions to see that they don't collide.
 
Last edited:

Similar Topics

For application purpose, what is the difference between a Fill instruction and a Copy instruction. rmonroe
Replies
2
Views
2,234
I have 2 7cp476 plcs. How can I copy one of them and install it somewhere else?
Replies
0
Views
68
Hello Inside a FB, I´m trying to transfer a string from a DB to a IN_OUT var that was define as a UDT. The problem is that i can´t determine the...
Replies
4
Views
121
Hi everyone I'm in a bit of a conundrum, I've been trying to get this HMI on our machine and I am unable to retrieve it. Device Delta Model...
Replies
10
Views
845
Hi I have a Melsec FX1S-20MR, which has been programmed. I would like to copy the program to a new FX1S-20MR? What are the possible ways to do...
Replies
4
Views
608
Back
Top Bottom