Studio 5000 COP (Copy)

einnh

Lifetime Supporting Member
Join Date
Mar 2014
Location
New England
Posts
275
Question about COP and UDT's in Studio 5000.

I have a UDT structure with various data types that is reporting (according to the properties tab in the UDT) to be 252 bytes.

If I wanted to copy this entire UDT variable into another variable with the same UDT would 252 be the number I enter at the end of the instruction?

Code:
cop(variablea,variableb,252);

The help file for COP uses the term 'elements' for what to put as the last input but it also shows a calculation for 'bytes' so I'm not sure exactly what they are referring to.
 
The COPy command won't write past the end of the destination. But lets say you have an 8 element array being copied to a 10 element array of the same type. If your length is 10 then, once the COPy has copied the first 8 elements it will continue picking up whatever garbage is past the end, in memory, of the source array. The byte count is basically a sanity check. It is even more important if you are copying from one type to a different type.
 
bernie_carlton said:
The byte count is basically a sanity check

Good thing the PLC is only checking it's own sanity and not that of it's programmer, or there'd be a whole lot more faulted PLC's out there ;)
 

Similar Topics

Am I losing it? Is it not possible to COP a UDT to another UDT in a function block routine? PLEASE HELP!
Replies
4
Views
1,530
Anyone have problems/solutions with Rehosting Studio 5000 to a new computer. Our IT department successfully Rehosted 2 laptops, but the other 2...
Replies
1
Views
101
Hi, I'm quite new to Rockwell PLC and currently trying to implement the following if Sw1 then for i:=1 to 20 by 1 do xEnable := 1...
Replies
4
Views
121
Hello! Hope you are great. I need to make a change in a PLC with ladder logic. I will mount a analog valve and I need to control it in ramp up...
Replies
7
Views
270
I have a few questions about Studio5000. 1. Why is my RA folder so big? its well over 100 GB. 2. How do you delete versions or extra files...
Replies
3
Views
256
Back
Top Bottom