??? 11/06/04 21:19 Read: times Msg Score: +1 +1 Good Answer/Helpful |
#80555 - RE: Int running on rising edge? Responding to: ???'s previous message |
On bigger programs it constrain the program flow dramatically, if CPU time was wasted by long delay routines.
Thus it is always a better approach to perform key debouncing and press detection inside a timer interrupt. Especially since most programs need always a time base, then it is easy to insert the debouncing in this time base interrupt handler also. My sample code: http://www.8052.com/forum/read.phtml?id=57958 To add release detection, simple add this line: <pre> ... i &= ct0 & ct1; // count until roll over ? // the following line must be added: key_release |= key_state & i; // 1->0: key release detect key_state ^= i; // then toggle debounced state ... Peter |
Topic | Author | Date |
Int running on rising edge? | 01/01/70 00:00 | |
RE: Int running on rising edge? | 01/01/70 00:00 | |
RE: Int running on rising edge? | 01/01/70 00:00 | |
RE: Int running on rising edge? | 01/01/70 00:00 | |
RE: Int running on rising edge? | 01/01/70 00:00 | |
RE: Int running on rising edge? | 01/01/70 00:00 | |
RE: Int running on rising edge?![]() | 01/01/70 00:00 | |
RE: Int running on rising edge? | 01/01/70 00:00 | |
RE: Int running on rising edge? | 01/01/70 00:00 |