Min / Max

bluenoser337

Member
Join Date
Apr 2003
Location
Nova Scotia
Posts
391
Searched but can't find an instruction in Studio 5000 to return the min and max values from a block of numbers (file, array...whatever). I wrote code to do this in a SLC and can do it again but thinking there must be something in 5000 to provide this functionality all these years later. Thanks!! :unsure:
 
Searched but can't find an instruction in Studio 5000 to return the min and max values from a block of numbers (file, array...whatever). I wrote code to do this in a SLC and can do it again but thinking there must be something in 5000 to provide this functionality all these years later. Thanks!! :unsure:

SRT

element 0 will be min, element {size of-1} will be max
 
Thanks daba! Forgot to mention that also I need the positions where the highest and lowest numbers were located. That could complicate things. Did it before with indexed addressing. For example: Highest pressure from sensor 12 at 99 PSI and lowest pressure from sensor 43 at 12 PSI.:whistle:
 
MOV ArrayOfValues[Pointer] to TestValue. Each scan, compare the value to the previously stored MIN/MAX, and if it evaluates as a new min/max, write the value of the pointer into a holding register. Then increment the pointer, rinse and repeat.

Make sure to check whether your pointer has reached the end of your array though, and reset it to zero when it does. Unless PLC major faults are your thing.

You can use a JMP/LBL pair to do all of this in one scan if you wanted - depends on how fast it needs to do the job. Or you could do the same thing with a for...do loop in ST, although I've not done enough ST programming to reliably tell you exactly how it's done :)
 
Yeah, thought that might be the case. Unfortunately I don't think there are any instructions to do that part of it any easier than it was in an SLC.

Probably the best answer I can give to "how can I do this better in Logix 5000?" is to write a for...do loop in ST, and then wrap it up an an AOI. There's an instruction to do anything in RL5K, just so long as you've got the time to build it ;)
 
write in in a subprogram 3 or 4 lines of code
then call it when you need the values
Label, jump to label it should only take you a few minutes to write it. I did it a few months ago just as to if it would run no problems
you can save 500 subprograms for later use it's just you don't have the private tags as all memory in public to all programs
 

Similar Topics

I've got a 4-20ma pressure transducer connected to an analog card on an AB PLC5. Under the setup for the card, I have to set a raw minimum and...
Replies
12
Views
7,316
Hope everyone is refreshed and ready to get back at it after new year! I'm struggling to find where or if i can set the min and max values of a...
Replies
1
Views
1,095
Hello, I am trying to modify a working program that uses parameter files for the different control items in the system. So for PID Loops there a...
Replies
12
Views
8,094
I have 16 cb_E connected to OP16 via fiedbus and the cb-E connected to l60 controllogix via en2t ethernet. using generic module in IO config so I...
Replies
2
Views
1,707
I'm really trying to test the limits of what SE can do with E-sig buttons for a customer. They want all the existing buttons converted to E-sig...
Replies
1
Views
1,748
Back
Top Bottom