RSlogix 5000 find highest value of array

The SRT instruction gives out the highest value detected, I think you can use a EQU instruction to compare this value to identify which one is the highest.

Maybe i'm wrong, haven't written a code to see if it works, but worth a try
 
+1 on Mickey's solution

First off you don't sort your Jam Array you sort a copy of it.

This does an array of 20.


XIC Find_High BST ONS One_Shot.8 COP Jam_Array[0] JamArray_Sort[0] 20 NXB SRT JamArray_Sort[0] 0 Sort_Control ? ? BND
EQU JamArray_Sort[19] Jam_Array[0] MOV 0 Array_HighPosition
EQU JamArray_Sort[19] Jam_Array[1] MOV 1 Array_HighPosition
EQU JamArray_Sort[19] Jam_Array[2] MOV 2 Array_HighPosition
EQU JamArray_Sort[19] Jam_Array[3] MOV 3 Array_HighPosition
EQU JamArray_Sort[19] Jam_Array[4] MOV 4 Array_HighPosition
EQU JamArray_Sort[19] Jam_Array[5] MOV 5 Array_HighPosition
EQU JamArray_Sort[19] Jam_Array[6] MOV 6 Array_HighPosition
EQU JamArray_Sort[19] Jam_Array[7] MOV 7 Array_HighPosition
EQU JamArray_Sort[19] Jam_Array[8] MOV 8 Array_HighPosition
EQU JamArray_Sort[19] Jam_Array[9] MOV 9 Array_HighPosition
EQU JamArray_Sort[19] Jam_Array[10] MOV 10 Array_HighPosition
EQU JamArray_Sort[19] Jam_Array[11] MOV 11 Array_HighPosition
EQU JamArray_Sort[19] Jam_Array[12] MOV 12 Array_HighPosition
EQU JamArray_Sort[19] Jam_Array[13] MOV 13 Array_HighPosition
EQU JamArray_Sort[19] Jam_Array[14] MOV 14 Array_HighPosition
EQU JamArray_Sort[19] Jam_Array[15] MOV 15 Array_HighPosition
EQU JamArray_Sort[19] Jam_Array[16] MOV 16 Array_HighPosition
EQU JamArray_Sort[19] Jam_Array[17] MOV 17 Array_HighPosition
EQU JamArray_Sort[19] Jam_Array[18] MOV 18 Array_HighPosition
EQU JamArray_Sort[19] Jam_Array[19] MOV 19 Array_HighPosition
 
OK, guys. I know I live in Wisconsin and have drunk away more brain cells than I am left with. But I don't understand what a sort will do for you in this case other than obscure the original information that is being sought and require additional evaluation to find it. Someone will need to explain to me how any of the solutions proposed using a sort is any cleaner than what destination unknown proposed in post 7.

Remember, the OP doesn't care what the value is or how it relates to any other value. He just wants to know what array location contains the highest value because that tells him the location on the machine the highest jam occurrence.

Keith
 
I understand the solution with the FOR loop will work.

I just offered Mickey's solution using common ladder logic and a brute force method. I also wanted the OP to understand that by using the SRT function you need to make a copy to work with and keep the original in tact.
 
Just to be clear for those of you scoring at home, the ladder that destination unknown posted above is a more compact version of what cwal61 posted, NOT the solution that destination unknown posted in post 7.

Keith
 

Similar Topics

I'm troubleshooting a customer's machine, and I've been racking my brain trying to figure out an answer to a question of where a value is being...
Replies
22
Views
3,366
Hey all, So we have had this piece of equipment for a while but its a question that always blows my mind away when troubleshooting this piece of...
Replies
2
Views
1,472
In Rslogix 5000, when searching for tags, is there a way to look only for destructives? Thanks.
Replies
8
Views
3,983
When i do the find all search from the drop down menu, it will do the search but the pop up box that shows all the found search's wont pop up...
Replies
3
Views
1,806
Hello, I am trying to read a barcode scanner input using a cognex dataman 280 barcode reader, store it another string, the compare with another...
Replies
1
Views
72
Back
Top Bottom