Hi Tim I've done this many times in C and assembler I use a timer to sample the switches. It is very easy to implement. I set the timer to interrupt every so often and in the ISR I read the port that has the switch[s]. The port input pin has a 10k or so pull up with a .1 ufd across it (this rids if of the bulk of the higher freq stuff/arcing. = I count the number of times it has been down. Three (or n depends on the clock speed and how many interrupts you can handle fewer is better in my mind but you need enough so that a very quick press ) interrupts or so in a row is a valid down and then I look for an up to tell me the person has let the go of the switch.. I then push the valid button push into a circular buffer. In my program when I need to know what/if button s pushed I pull the button push from the buffer. If there was no push I get a zero if a button was pushed I get the number telling which button was pressed for n number of counts and then went up. I like it because it forces the user to make individual presses of the button. = I haven't implemented here yet but you could set a global var in the code that tells the ISR not to look for the up and to go ahead and push the key pressed on to the buffer for a valid down. This would allow the user to hold the key down if he were in a scenario where he needed to scroll through a long list or inc or dec something with fine granularity. I'm going to put this feature in my brightness and contrast control handling routines Let me get that in there today and I'll send you the code. I want to make sure the command buffer doesn't over flow o I will probably need to change the number of counts while in this mode also. = = = = Phillip Things should be as simple as possible but no simpler = = = Phillip Coiner CTO, GPS Source, Inc. = = Your source for quality GNSS Networking Solutions and Design Services, Now! -----Original Message----- From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On Behalf Of Tim Losereith Sent: Monday, April 03, 2006 3:13 AM To: piclist@mit.edu Subject: [PIC] debouncing in c Hello, I am looking for an example to debounce several push buttons in c. While = debouncing the micro shouldn=B4t be blocked by a timer. -- = Mit freundlichen Gr=FC=DFen/Best regards, = = Tim Losereith = = -- = 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