Sign in to follow this  
Followers 0
angeraer

'Select case' programming in Omron

4 posts in this topic

Hello, I need to program this kind of test in a program. If x between 0 and 10 then elseif x between 11 and 20 then enable bit a elseif x between 21 and 30 then enable bit b else enable bit z ... What is the best way to do this? (Omron C200HX). Using the compare instruction? (I have a value between 0 and 72 representing a wind direction on a scale of 0 to 360°. I want to show the wind direction as readable text on a HMI.) Thanks, Andy.

Share this post


Link to post
Share on other sites
Is the data coming in to just 1 word? I would imagine it is. What is the word type? Hopefully BCD. If so, try this, and so on for the other numbers. Keep the lot in the same rung if you can. You must place the compare bits (>, =, <) immediately after the respective compare so that the PLC will pair couple them. Compare.pdf

Share this post


Link to post
Share on other sites
BobB, Thanks for the example! Helped a lot! Andy.

Share this post


Link to post
Share on other sites
Here is another option for you: ZCP, this will compare a number to a range. So a bit will turn on if your number is between a low limit and a upper limit. ~Andrew NewPLC1.pdf

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