Sign in to follow this  
Followers 0
mustaqim90

how to write program to find max and min value

7 posts in this topic

hi. i have a problem. im using omron cx-programmer..how to write the program to find maximum and minimum value in ladder diagram using the formula (tn < tn-1) and (tn > tn-1). help me..

Share this post


Link to post
Share on other sites
Hi, Which PLC do you have? Most of them have a instruction to finds the max/min value in the range. there are also some options like unsigned or sgined. You can check the max/min commands for details from help on cx programmer.

Share this post


Link to post
Share on other sites
I do this often, very simply, by moving the value in a register, and comparing that value to the actual value. The comparison instruction has to be scanned first then it will compare to the value present in the previous scan. In other word the Compare instruction must be before the Move instruction in the ladder.

Share this post


Link to post
Share on other sites
Use MIN and MAX functions.

Share this post


Link to post
Share on other sites
What is your PLC?

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