After ten years programming a machine in a noise environment, have adopted the practice to debounce every digital input from a sensor as well as I/o lines from other controllers. Even find myself wanting to debounce flags that I set myself under software control. Also after reading the i/o lines, exclusive or them so that true is a '1' value. This makes the program much more readable. and use '1' for outputs true, then exclusive or them before putting them in ports. Bill ----- Original Message ----- From: "Olin Lathrop" To: "Microcontroller discussion list - Public." Sent: Sunday, January 01, 2006 5:32 AM Subject: Re: [PIC] Comments on keypad design? > Bob Blick wrote: >>> This is fine if you're only worried about bouncing on transitions. >>> If you are doing filtering or the switch could bounce in one of the >>> states (like a momentary pushbutton), then you need to sample faster >>> and apply debouncing or filtering logic. >> >> You're going to have to back that up with details or we'll all just >> decide you're blowing smoke (or inhaling it, this is New Year's Eve, >> after all :) > > Others have already elaborated. The kind of switches where your finger is > mechanically tied to the contacts that close can have noise or bounce when > the finger is wiggled. Usually the ones with a solid click feel don't > have > this problem or at least a lot less. On some switches the thing you touch > just trips a mechanical bi-stable assembly one way or the other, and they > don't have this problem. > > Try using two wires as a switch holding the wires an inch or so from the > connection point. Use the "switch" to connect a small speaker to a 5V > supply thru a 200ohm resistor. You'll hear noise as you rub the wires > even > though they are "connected". Similarly, your inevitable hand movement on > the right type of switch can cause the same effect. > > > ****************************************************************** > Embed Inc, Littleton Massachusetts, (978) 742-9014. #1 PIC > consultant in 2004 program year. http://www.embedinc.com/products > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist