whether the following debouncing logic will work well: the total cycle for code is 50ms and each function is executed only once during the cycle.
void main() { signed int deb_Counter=0; while(1) { input(); process(); output(); } } int debounce() { if(key_pressed) { deb_Counter++; } else { deb_Counter--; } if(deb_Counter>10) { deb_Counter=0; return(1); } else { deb_Counter=0; return(0); } }
this code is reffered from web with thanks, karthik
You have deb_Counter local to main and are trying to access it within the separate function debounce.
"this code is reffered from web"
Suggest you look elsewhere.
hello kartik.
you can call debounce function from main and debug it. you will come to know is the timing parameters you defined is correct or not.
Regards ankit thakkar
the fact that it does not even compile does not seem to disturb you...
View all questions in Keil forum