Other Parts Discussed in Thread: MSP430F5418
Hello All,
I am using MSP430F5418 with IAR.
I have 32KHz ACLK. and a button is connected to P1.0
My aim is to swap the state of an LED connected to P5.1 after two seconds from the time of button press.
Below is my code. My problem is, some times the LED is blinking with correct interval and some times not.
Can anybody tell me why is it so??
int main(void)
{
WDTCTL = WDTPW + WDTHOLD;
P1IE |= BIT0;
P5DIR |= BIT1;
TBCCR0 = 0xffff - 1;
TBCTL = TBSSEL__ACLK + MC__UP + TBCLR; // ACLK, upmode, clear TBR
__enable_interrupt();
for(;;);
}
#pragma vector=TIMERB0_VECTOR
__interrupt void TIMERB1_ISR(void)
{
P5OUT ^= BIT1;
TB0CCTL0 &= ~CCIE;
}
#pragma vector = PORT1_VECTOR
static __interrupt void keypad_isr (void)
{
TB0CCTL0 |= CCIE;
P1IFG = 0;
}