Part Number: MSP430I2031
Other Parts Discussed in Thread: MSP430I2031
dear sir,
i am working on msp430I2031 ic
i want to implement two button reducing key(interrupt based) bouncing issue
if have example pls help me
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.
Part Number: MSP430I2031
Other Parts Discussed in Thread: MSP430I2031
dear sir,
i am working on msp430I2031 ic
i want to implement two button reducing key(interrupt based) bouncing issue
if have example pls help me
Hi Hiren,
try the Code Composer Studio Resource Explorer for device specific Code Examples.
This is written for FR5969 - so you might have to adjust ports. This code toggles the Port 4.6 LED1 on when Button1 on Port 4.5 is pressed and off when released.
I have not had any bouncing issues with this. Otherwise you could set a minimum debouncing time and compare it with a timer each time your Interrupt is called.
For further information try: www.ganssle.com/debouncing-pt2.htm
#include <msp430.h>
void InitializePins(void);
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop WDT
PM5CTL0 &= ~LOCKLPM5;
InitializePins();
__bis_SR_register(LPM0_bits + GIE); // Enter LPM0 w/ interrupt
__no_operation(); // For debugger
}
void InitializePins(void)
{
P4DIR &= 0x00;
P4OUT &= 0x00;
P4DIR |= (BIT5 + BIT6); // as output
P4OUT |= BIT5; // pull-up mode
P4REN |= BIT5; // pull-up enable
P4IE |= BIT5;
P4IES |= BIT5;
P4IFG &= ~ BIT5;
}
// Timer0_A0 interrupt service routine
#pragma vector = PORT4_VECTOR
__interrupt void Port_4(void)
{
P4OUT ^= BIT6;
P4IES ^= BIT5; // Toggles rising + falling Edge
P4IFG &= ~BIT5;
}
**Attention** This is a public forum