moving an array into a UTD

asterof

Member
Join Date
May 2007
Location
Califonia
Posts
554
oops that would be a UDT or a UTD

CSF_Array1 has four elements of Real
I have a UDT named Cost_SQFT
that has four elements

Cost_SQFT.cost1
Cost_SQFT.cost2
Cost_SQFT.cost3
Cost_SQFT.cost4

In one instruction I want to move
CSF_Array1[0] into Cost_SQFT.cost1
CSF_Array1[1] into Cost_SQFT.cost2
CSF_Array1[2] into Cost_SQFT.cost2
CSF_Array1[3] into Cost_SQFT.cost3

not use four move statements

can a COP CSF_Array1[0] > Cost_SQFT
length of 4 work
 
Last edited:
The length needs to be 1. The COP instruction length is used for the destination only. It will retrieve as many source elements as required to satisfy the destination. In your case, to fill 1 Cost_SQFT, 4 reals are required

The COP instruction will do the following:
CSF_Array1[0] ==> Cost_SQFT.cost1
CSF_Array1[1] ==> Cost_SQFT.cost2
CSF_Array1[2] ==> Cost_SQFT.cost3
CSF_Array1[3] ==> Cost_SQFT.cost4

This is what you want:

CopyUDT.JPG
 

Similar Topics

Hi All, I cannot seem to find a way to move a Boolean from an Arrays UDT into a DINT. I have an Array of 32 elements with a UDT data type of 4...
Replies
3
Views
1,742
Hey all, This is more of a question of "can I do this more efficiently" rather than how do I do this... We collected a week's work of...
Replies
4
Views
3,346
Hello all, The task at hand is a little tricky for me... a novice at best... This is all about an alarm and storing data into rs batch. I have...
Replies
3
Views
5,429
Hey everyone. I am very new to using RSlogix and from the bit of searching this forum I've done, I found that everyone seems to be really helpful...
Replies
6
Views
10,215
I'm a Siemens person, and this is one of my first AB programs. The customer wants everything programmed in Ladder. I have a lot of data (3...
Replies
14
Views
218
Back
Top Bottom