Good morning everyone.
I am apparently confused on the COP instruction.
Please let me attempt to remove your confusions....
What I will describe about COP applies equally well to CPS and FLL.
The in-built instructions like MOV, and the file instructions like FAL, all have the natural ability to automatically change data-types between the source data-type, and the destination data-type. This means that every single element of an array in a FAL instruction will have to be parsed and converted if necessary. All very time-consuming ...
COP, on the other hand, was designed and implemented in the instruction set as a "fast" data copier, and doesn't need the control structure of a FAL. Nor does it do any data-type inspection or conversion.
Instead, the COP instruction calculates the number of bytes it is programmed to copy, by multiplying the number of bytes of the
destination data-type, by the length of the copy. So a DINT (4 bytes) array of length 100 would calculate the number of bytes to copy as 400 bytes.
Then the controller would simply byte-copy those 400 bytes from the source, and deposit them in the destination. No data-conversion, no error-checking(*1), just get on with it as fast as you can....
CPS does exactly the same thing, except that it suspends interrupts while it is executing, which might cause the source or destination "data-set" to be changed during the copy. I personally always use CPS, just to be on the safe side.
FLL obviously keeps resetting its source byte-pointer to constrain the bytes being copied to the source size (note there is no FLS like there is a CPS !)
*1 above : The only error-checking that takes place is that COP will stop mid-way if the destination's tag end is reached
(EDIT : And there is no way to know this has happened, not even a Minor Fault !). This is protection against overwriting other data memory if the instruction is badly configured. HOWEVER !!!! If the destination is a member of a structured tag (UDT), and it is not at the end of that tag, an incorrectly configured COP, CPS, or FLL can trample over the data areas for following members. They only check for the end of the entire destination
tag.
So in your case COP or CPS would have been inappropriate, as you would not be addressing contiguous memory, and as I have shown you have to use FAL
Hope that hasn't confused you more ....