Sign in to follow this  
Followers 0
TrevorD

Finding the max values in an Array

3 posts in this topic

Hi all

I have a project where i am building a bread softness tester. 

To do this i am using a smc electric actuator and an A&D scale.

The electric actuator will push down on a slice onto an A&D scale.  A micro830 plc is then reading the data from the scale and storing the real variable in an array 80values long. 

I would like to display on the hmi (panelview800) the peak/maximum value in the array. I am struggling on how to do this though and have not found much information online.

any help would be much appreciated

Thanks in advance

Trevor

Share this post


Link to post
Share on other sites

your array has 80 elements.

assume that first element is the greatest, then check if that is true by comparing each of remaining elements using loop. if any element is larger than current Max value, use the new value as max. when loop is done, you will have the max value. put it in a register that PV can display

Share this post


Link to post
Share on other sites

I haven't worked with the Micro800s, but other AB processors have a sort (SRT) instruction that will sort the array in ascending order so the largest value ends up in the bottom (highest index) register. Does the Micro800 have a sort instruction?

1 person likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0