Sign in to follow this  
Followers 0
Riggs

Switch Debouncing

6 posts in this topic

Hi again, Omron CJ1 with ID201 input module: Before I embark on writing some code for debouncing input switch contacts, is there a standard way of accomplishing this? I've not yet found an appropriate instruction or function block. Cheers, James. Edited by Riggs

Share this post


Link to post
Share on other sites
What do you mean, by "debouncing"?

Share this post


Link to post
Share on other sites
Depending on the debounce time needed, you may be able to adjust the input response time. You will find that under Settings/Unit Settings. Maximum would be 32msec. It will apply to ALL inputs on the module. Hope this will help.

Share this post


Link to post
Share on other sites
A simple software timer (TIM or TIMX) behind your switch would do the trick.

Share this post


Link to post
Share on other sites
Hi, Thanks for replies (in answer to 'pfort': whan a mechanical switch, eg. a push button, is pressed, the contacts will close and open a few times very fast as they bounce off each other before settling into the closed position. This can cause multiple edge detection when you are only interested in the first edge). I don't think my hardware can be set up to avoid this, however dwestes' suggestion of a software timer will do the job easily, thanks! James.

Share this post


Link to post
Share on other sites
Another way to do this, I usually use a set/reset bit so that the code can react the instant that the button or sensor is actuated. Set a bit when you detect the rising edge of the input and reset the bit at the end of the cycle/operation.

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