Help with Array of UDT's Logix 5000 v19

bdr1234

Member
Join Date
Jan 2012
Location
Detroit
Posts
4
Hopefully a quick question :

I'm trying to shift the elements in an array of UDT's (25 elements). The base UDT looks someting like this, but much longer:

Name - STRING
Age - INT
Active - BOOL

The array is PEOPLE[25] of the UDT listed above.

I thought the FAL would work great to shift them up, but it doesn't work:

FAL
Control : CTRL
Length : 24
Position : 0
Mode : ALL
Destination : PEOPLE[CTRL.POS+1]
Expr : PEOPLE[CTRL.POS]

That should have shifted everything up by 1 element, overwriting the last element in the array. But alas, it doesn't work.

Any ideas other than writing out For Next loops for every element?

Thanks!:confused:
 
Actually, the RSLogix editor won't accept the rung.

The next problem I expected is the one you mention...I've seen posts about problems if the length of the string isn't explicitly specified, might cause problems, especially on an HMI. So I was expecting to have to "clean up" the shift operation, but I can't even get the editor to accept the rung.

I created (for testing) a simple array of DINT's, and it works fine. As soon as I switch to the array of UDT's, editor is not happy.

I even deleted the rung and recreated it, in case there was something fishy there.

I'm thinking about setting up 24 COP instructions since I'm becoming frustrated. not elegant, but it ought to work (at least the editor accepts the rung!)

Thanks!
 
It looks like the expression must deal only with elemental types. You probably need a FOR/NEXT loop with the COPy command inside the target routine.
 
A simple COP with a length of 24 may work but still do the backward (1 -> 0, 2 -> 1 etc) type copy. Source = 1, Dest = 0 Length = 24

Bernie is correct COP works perfectly with arrays of UDTs. See the 2 pics where PEOPLE[1] moves to PEOPLE[0], [2] to [1], [3] to [2], etc.

Things to watch out for....

Array indices start at 0, so the last element of an array 25 in length is 24.

Don't keep the COP instruction true for more than 1 scan. It will empty the array in 25 scans.


edit : someone sharped-eyed might have noticed my PLC clock was a day out....sorted

2012-01-22_205539.jpg 2012-01-22_205602.jpg
 

Similar Topics

Hello! The equipment I'm working on uses a lot of indexed tags I guess you'd call them. I thought it was indirect addresses maybe but all the...
Replies
9
Views
1,054
Hello all, I need some guidance creating a FIFO array to display data into an HMI. The data will be the sum of jams of a conveyor section in an...
Replies
5
Views
2,695
hi, i try to capture barcode data using UDT with SINT ascii array. i have all the data i need but it in array format, how can i convert to 1...
Replies
5
Views
3,062
Hello all, I'm working on my first project with an Allen Bradley Micro 810 using the connected components workbench. Everything is going well so...
Replies
2
Views
3,162
Hello All, Needing some help with finding Min max values in an array that can have a dynamic element count. The Sort function in Logix 5K only...
Replies
9
Views
5,719
Back
Top Bottom