Hi all Does any one have keymatrix debounce example on keil c. Thanx
Hi Mahmood! I usually do that in an timer interrupt routine.
if (--tsec_counter == 0) { tsec_counter = DEF_10TH; if (t0_10thcnt > 0) { --t0_10thcnt; } if (((~INPORT) | 0xc0) != input_new_state) { input_new_state = (~INPORT) | 0xc0; t0_bounce = bounce_time; } if (t0_bounce != 0) { --t0_bounce; } if ((input_new_state != input_old_state) && (t0_bounce == 0)) { input_active |= input_pedge & (input_old_state ^ input_new_state) & (input_new_state & ~input_old_state); input_active |= input_nedge & (input_old_state ^ input_new_state) & (input_old_state & ~input_new_state); input_old_state = input_new_state; input_triggered |= input_active; } }
thx Sven u r a saint!