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: 2024/12/1 22:16,
TOP NEW HELP FIND: 
18.226.93.138:LOG IN

 ©2024 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! / MAKE!

<A HREF="http://techref.massmind.org/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 visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. 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: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to massmind.org!

 

Welcome to techref.massmind.org!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .