Posted 4 Sep 2009 (edited) 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 4 Sep 2009 by Riggs Share this post Link to post Share on other sites
Posted 4 Sep 2009 What do you mean, by "debouncing"? Share this post Link to post Share on other sites
Posted 4 Sep 2009 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
Posted 5 Sep 2009 A simple software timer (TIM or TIMX) behind your switch would do the trick. Share this post Link to post Share on other sites
Posted 7 Sep 2009 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
Posted 27 Oct 2009 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