Switch Debounce.

Moderator: Benj

Post Reply
medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Switch Debounce.

Post by medelec35 »

I will put my Β£10.50 worth (after seasonally adjusted figures :P ) In. At present debounce is only available in waituntilhigh and waituntillow options. It is not ideal. I believe by far the best method was how canipus on Fri Jan 05, 2007 2:41 pm describes it should be done.
See http://www.matrixmultimedia.com/mmforum ... 1575#p1575
i.e switch i/p is level is checked, then routine continues only when i/p is stable. that way if switch is getting old, or is cheap contact bounce can take longer, so this is accounted for. If using an osc i/p then you wont need to tick the debounce option, so no chance of hanging up. Debounce should only remain as an option on inputs for that reason.
This can apply to properties of i/p icons. perhaps have Two options. tick for auto debounce (option 1) and tick for debounce time-out time in ms (option 2) .
So you can have none , option 1 ticked, option 2 ticked, or both option 1 and 2 ticked.
Martin

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Switch Debounce.

Post by Benj »

Thanks Medelec

I have added your suggestion to the wish list for future releases.

I have also had a look at your hardware that you sent in and can confirm that it was a simple problem. The Jumper connecting the USB chip to the programming pins had stopped making contact. Replacing this jumper had everything up and running again. :mrgreen: Anyway it should be back on its way to you now.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Switch Debounce.

Post by medelec35 »

Thanks Ben that's great news. Will look out for that myself next time 8)
Martin

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Switch Debounce.

Post by medelec35 »

Has switch debounce been added already?
If not a more simple solution.

If all the inputs just have an option to enter a debounce time. From 0 to 100ms for example.
That way if 0 is entered (default?) then no switch debounce is used.

If 10 is entered for 10ms then i/p is read, wait for delay of 10ms. re-read i/p, assign value of input to variable since debounce time has elapsed.

Martin
Martin

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Switch Debounce.

Post by Benj »

Hello Martin,

That was what I originally thought, however for full switch debouncing support as people would expect it should really be done like this which is a lot more involved.

Read Switch Input
Start the debounce delay
While delay is running continually monitor the state of the input
if the input state changes at all then reset the delay
if the delay reaches the end then we have a definite stable de-bounced input.

I remember having a chat with Steve about this a few years ago. Maybe we just go with your suggestion as full debouncing may take a while to do properly and because of this, may never end up getting done.

Post Reply