Compare Array Values

Jason366433

Member
Join Date
Apr 2023
Location
Prattville, AL
Posts
2
I'm working on an array that contains a UDT of 5 Items

Array[4]
DataType[0]
- Part 1
- Part 2
- Part 3
- Part 4
- Part 5
DataType[1]...etc

I'm wanting to compare Part 3 in all the Data Types in this Array to determine if have duplicate values. If I do have Duplicate values I'm wanting to turn on an (OTE).

I was thinking of using an (EQU) function or a (CMP) function to achieve this but I'm having trouble writing the tag in the instructions. I'm probably overlooking something dumb but wanted to pick you guys brains.

Also I would be open to any suggestions on coding this differently. Thanks all.
 
With only 4 items in the array it takes but six compares ORed together to write the bit via the OTE. E.g. in Allen-Bradley mnemonics (one rung):

BST EQU ARRAY[0].part3 ARRAY[1].part3
NXB EQU ARRAY[0].part3 ARRAY[2].part3
NXB EQU ARRAY[0].part3 ARRAY[3].part3
NXB EQU ARRAY[1].part3 ARRAY[2].part3
NXB EQU ARRAY[1].part3 ARRAY[3].part3
NXB EQU ARRAY[2].part3 ARRAY[3].part3
BND OTE DUPLICATE_IS_PRESENT
 
Last edited:

Similar Topics

Hi out there is it possible to Compare a bool array to a bool, in studio 5000. I'm think that if One of the bool's in my array is true, then i...
Replies
10
Views
6,375
All, We have a 6 lane conveyor to carry bars and at the end we have a pick and place which picks up the bars if a sensor detects it. For all 6...
Replies
0
Views
2,211
I've come across an application that might be hard to explain, however I think there might be a simple explanation. I am doing an array of...
Replies
3
Views
3,427
Hello again- after the nice thread on filling the .pre's on timer arrays, I'm in another bind. I need to look at 60 timer_array.dn bits and see...
Replies
20
Views
3,960
I have a UDT that has 3 UDT's inside it. One is used for control and two are used for status. In the polling PLC I need to examine the CMD...
Replies
14
Views
4,014
Back
Top Bottom