please dont rip this site

PIC Micro Controller C Input / Output Routine


CCS code for button pressing debouncing

by Damon Hopkins

you can fiddle with the delay I have it count for 50 ms in between reads and then when it counts 5 button presses it returns

// wait_for_release(PORTA,0)
void wait_for_release(char port, short pin)
{
	char x=0;
	while(x != 5)
	{
		if (!bit_test(port,pin))
			x++;
		else
			x=0;
		delay_ms(50);
	}

}
// wait_for_press(PORTA,0)
void wait_for_press(char port, short pin)
{
	char x=0;
	while (x!=5)
	{
		if (!bit_test(port,pin))
			x=0;
		else
			x++;
 		delay_ms(50);
	}
}

Interested:


file: /techref/microchip/language/c/debounce-dh.htm, 1KB, , updated: 2007/9/14 16:52, local time: 2008/12/1 17:37,
TOP NEW HELP FIND: 
38.103.63.55:LOG IN
©2008 PLEASE DON'T RIP! DO: LINK / DIGG! / MAKE!

 ©2008 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it!
<A HREF="http://www.sxlist.com/techref/microchip/language/c/debounce-dh.htm"> Microchip PIC, keyswitch, switches, debounce, CCS C compiler, Damon Hopkins</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be reviewed) Just type in the box and press the Post button. (HTML welcomed!): A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Did you find what you needed?

 

Welcome to sxlist.com!


Site supported by
sales, advertizing,
& kind contributors
just like you!

Please don't rip/copy
(here's why

Copies of the site on CD
are available at minimal cost.
  'What can I do?' - SiCKO

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .