Comparing 1 UDT to another (Same UDT Type) In Logix?

skyfox

Lifetime Supporting Member
Join Date
Nov 2006
Location
CA
Posts
279
Hello,

For sake of discussion;

I have a UDT defined as follows;

UDT1
------------------
Member1 = String
Member2 = DINT
Member3 = DINT
etc. etc.


This is important, I do not want any individual member in the UDT to be part of an array.

Now I create a controller Tag Name MYDATA[10] of type UDT1 (i.e. MYDATA is an array of 11 UDT1's)

I can do.....

COPY MYDATA[1] to MYDATA[2]..... No Problem.

But I can't compare (but I would like to);

If MYDATA[1] = MYDATA[2].

Is there a way to do this or is it not possible with RsLogix 5k (V19)?

Thanks.
 
Alternative

You can also copy the UDT to a DINT array and used ST to do a while loop checking the equality of each DINT. You need to create 2 DINT arrays the same size (or slightly larger) as the UDT. This avoids the need to modify the AOI when you change the UDT, but you'll still need to resize the DINT. The AOI ST can remain unchanged as you just pass in a DINT[1] and check the length. The same AOI would works for any UDT really.


The ladder EQU takes 0.09us vs ST = which takes 0.02, so ST is the way to go for the comparison.
The COP takes 0.02us per DINT, same as the ST = comparison.
So 0.04us x array size (in DINTs, ie bytes/4) is roughly how long a blind check would take.
 

Similar Topics

I’m running a micro 820 to measure a tank level, then turning on equipment at certain levels. I have an analog input (4-20) that I’m storing and...
Replies
10
Views
272
How do you go about implementing, on the M580 PLC, how many days, hours, minutes before a predefine event in the future? The RRTC_DT yields the...
Replies
3
Views
1,805
This is a Citect SCADA question I have Six variables of type REAL (Float) to compare and determine (identify) which variable has the highest...
Replies
4
Views
1,407
I have currently made a logic to read Serial input from a barcode scanner. The situation is that I need to read the barcode from the machine and...
Replies
5
Views
2,036
Hello, We are using Schneider SCADAPack 357 and Trimble Acutime 2000GPS. We are getting the data as a string(ASCII) from...
Replies
3
Views
1,471
Back
Top Bottom