>Hi Folks, >I'm just wondering if anybody has any really good methods of switch >Debounce. I want to implement a push button switch (Attached to a Pull-Up, >and when closed pulling down to ground). >I tried putting in a simple loop (decrement a value 255 times) to fix the >problem and while it helped, it certainly isn't perfect. >Any idea? >Myke I always use 20 mS as a rule of thumb for switch bounce time. One of the few things PICs do poorly is waste time. How much time did your loop take? At any reasonable clock rate, the PIC executes 255 iterations in far less than 20 mS. Your approach is fine, but you need to make sure the delay is at least 20 mS. The only problem arises if you need to be doing something else while you are timing the switch. To be more robust, you could look for a minimum duration of switch on before recognizing a valid closure and a minimum duration of switch off before recognizing a release. 5 mS would be a good starting point. - Mark Sullivan -