This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
I am getting a noise on Edge triggered interupt. Below is the code for that. I make a decesion SwitchedACCycleDetected = 1; on every edge detected.
But some times noise getting edge triggered making my variable SwtichedACCycleDeteced = 1.
Can somebody send me debouncing code for edge triggered interrupt.
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{
INT++;
P1IFG &= ~BIT2;
SwitchedACCycleDetected = 1;
SwACDetection = 0;
}
Thanks,
Hey,
I'm new to MSP430, but I think for software debouncing you need to check, delay, and check again ;)
http://e2e.ti.com/support/microcontrollers/msp43016-bit_ultra-low_power_mcus/f/166/t/28266.aspx
I think the function is more or less:
__delay_cycles(count);
or something like
for(i = 0xFFF; i> 0; i--) {}
:)
Good luck!
kazola said:I think the function is more or less:
__delay_cycles(count);
or something like
for(i = 0xFFF; i> 0; i--) {}
Hi Kazola, first is ok, second one cannot work if variable is not declared as volatile, if optimization is enabled all the for code can be flushed away.
To be sure key get debounced you need a decision on time of pressure, if time after bouncing elapse and key is still stable and pressed then decide key is down. Again when key released short change can be ignored and start timing after it is stable for a while.
regards
HI, in a different thread Jan Kesten provided the following link.
There is some general reading about bounces here:
http://www.ganssle.com/debouncing.htm
HTH,
Barry
**Attention** This is a public forum