Can you expand your code a bit that show two routine, one main routine and one interrupt service routine?Make sense?
maybe get some idea
C:
unsigned char counter;
bit BUTTON_x;
if input == FALSE{
counter = 0; // button is open, reset everything
BUTTON_x = FALSE;
}
else{ // input is true, debounce if necessary
if(BUTTON_x == FALSE){ // if button closed but not fully debounced yet
counter++;
if(counter == DEBOUNCE_TIKS)
BUTTON_x = TRUE; // fully debounced
} // else, button TRUE and is already debounced, nothing to do
} // input is true
Which line in the code check the switch whether it is open or closed?
Last edited: