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.

MSP430FR2111: MSP430 Timer Interrupt

Part Number: MSP430FR2111

Hello, 

I am trying to generate a simple timer using the 16 bit Timer0_B3 of the MSP430FR2111. The idea is to generate an interrupt and toggle a pin inside the ISR. I am missing something as the code does not work. Here is my code for the same.

#include <msp430.h>

//#define PERIOD 50000;   // value to be stored and counted to in the CCRx register

void initSleepTimer();

void main(void)
{
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer

P1OUT &= 0x00; // Shut down everything
P1DIR &= 0x00;

P2OUT &= 0x00;
P2DIR &= 0x00;

PM5CTL0 &= ~LOCKLPM5; // Disable GPIO Power On high impedance state

P1DIR |= BIT4; // Set P1.4 as output
__enable_interrupt();

initSleepTimer();


}

void initSleepTimer()
{
TB0CCR0 = 50000; // Count up to the value stored in TB0CCR0
TB0CCTL0 = CCIE; //CCR0 Interrupt Enabled
TB0CTL = TBSSEL__ACLK | MC__UP | TBCLR; // select the ACLK, UP mode, clear TBR to start counting

}


#pragma vector=TIMER0_B0_VECTOR
__interrupt void TIMER0_B0_ISR(void)
{
P1OUT |= BIT4; // Toggle P1.4 at the interrupt
}

I don't see P1.4 toggle. Any thoughts?

Thanks,
Ganesan M.

**Attention** This is a public forum