COP Real array into a UDT ?

HoldenC

Member
Join Date
Sep 2012
Location
Cumberland, KY
Posts
220
I am trying to copy an array of real numbers into a UDT with a real data type element. I have attached a snip below showing my COP instruction. However, when the COP is executed, its not coping properly. The destination isn't receiving all of the real numbers. Below is a example

Source DEST
ARRAY[1] ARRAY[1]
ARRAY[3] ARRAY[2]
ARRAY[5] AARAY3
1712592232664.png

Can anyone offer any help or suggestions ?
 
If they are in order, FAL is one way to go:
  1. use SIZE to get the array_size (prevent over running array boundary)
  2. the len for the FAL is array_size
  3. dest -> udt_array[ctrl.pos].real_element
  4. source -> real_array[ctrl.pos]
 
What's your data structure? It looks like you have an array of positions that you're trying to transfer into .Position elements of an array of UDTs. Like this:
Source:
Position[0]
Position[1]
Position[2]
etc.

Destination
Belt[0].thing1
Belt[0].thing2
Belt[0].Position
Belt[0]thing3

Belt[1].thing1
Belt[1].thing2
Belt[1].Position
Belt[1]thing3

Etc.

If that's the case, a simple COP instruction won't work. First thought is to loop through like this:
MOV Position[x] Belt[x].Position
x +=1
...limit check and stop when x = value of highest array index
Something like that...
 
As Destination described, use a FAL. The best way to move arrays into non contiguous array elements. No looping involved, the FAL handles it.
 

Similar Topics

Hello all. I have a Danfoss VLT feeding an INT into my CpLX program. I need to concatenate the MSB and LSB for position. I used a COP, making sure...
Replies
10
Views
646
Hello, I have been looking for a reference for the order that a UDT is copied in the COP instruction. More specifically - I have a set of code...
Replies
5
Views
555
I'm having to make an AOI to use with a generic ethernet device because the manufacturer does not provide an AOP. I just want to do a sanity check...
Replies
13
Views
1,265
We're converting a machine's control from CompactLogix to Micro800. It was originally going to be on a Micro850. However, because we've ended up...
Replies
2
Views
1,597
Long time lurker, first time poster.. I've been working with PLCs for a while now and have ran into a head scratcher that I was hoping someone...
Replies
8
Views
2,244
Back
Top Bottom