Olin, could you exemplify your valuable explanation with a piece of code ? I'm interested how you check for 50 consecutive samples. Thank's, Vasile On Wed, 7 Feb 2001, Olin Lathrop wrote: > > Is there a way to debounce a switch in S/W? > > Lots of ways. I usually end up with some sort of periodic interrupt anway, > usually every 1mS. I have the interrupt routine check the input to be > debounced every clock tick, and set a software flag to the new state if the > input was the same some number of samples in a row. I like to use 50mS for > the debounce time. In other words, I don't consider the input as having > changed state until it has been the same for 50 consecutive samples at 1mS > per sample. > > > ***************************************************************** > Olin Lathrop, embedded systems consultant in Devens Massachusetts > (978) 772-3129, olin@embedinc.com, http://www.embedinc.com > > -- > http://www.piclist.com hint: The list server can filter out subtopics > (like ads or off topics) for you. See http://www.piclist.com/#topics > > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.