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.

MSP-EXP430F5529LP: MSP430F5529

Part Number: MSP-EXP430F5529LP
Other Parts Discussed in Thread: TRF7970A

Hi,

I want to add timer to the "F5529LP_TRF7970A_ALL_NFC_MODES" project but i can't.

In your code there is a one function about clocks:

void MCU_init(void)
{
    WDT_A_hold(__MSP430_BASEADDRESS_WDT_A__);

    // Setup XT1 and XT2
    XT1_XT2_PORT_SEL |= XT1_ENABLE + XT2_ENABLE;

    // Set Vcore to accomodate for max. allowed system speed
    SetVCore(3);

    // Use 32.768kHz XTAL as reference
    LFXT_Start(XT1DRIVE_0);

    // MCU Frequency = 25MHz
    Init_FLL_Settle(MCLK_MS_COUNT, 762);

}

I wrote the following code between the init lines.

        TA0CCTL0 = CCIE;
        TA0CCR0  = Count_No;
        TA0CTL   = TASSEL_2 + MC_1 + TACLR;

What is the value for 1ms timer for Count_No?

and the intterupt vector :

#pragma vector = TIMER0_A0_VECTOR
__interrupt void TIMER0_A0_ISR (void)
{

// 1ms timer code...

}

Thanks for your attention...

  • Hello,

    TI example code makes it really simple to incorporate modules, such as timers, into a customer's project. The link provided ( http://dev.ti.com/tirex/#/?link=Software%2FMSP430Ware%2FDevices%2FMSP430F5XX_6XX%2FMSP430F5529%2FPeripheral%20Examples%2FRegister%20Level ) has Timer0 and Timer1 examples that show how to initialize and implement the MSP430 Timer module. Take a look at these examples to find information on using the timer module, timer interrupt vector, and how to calculate the register values for a specific time interval (i.e. 1ms).

    Hopefully this helps you successfully add "Timer" functionality to your project!

    Best regards,

    Matt Calvo

  • Hi Matthew,

    Thanks for your answer but i know how to arrange the timer interrupt. My question is about your Mcu_init function. it's change the clock for this reason i can't calculate the right values for 1ms timer interval.

  • The value to put inside of the TA0CCR0 register is a function of what the clock speed is for the Timer Module. From the code you provided, it looks like the timer is being sourced by SMCLK and I don't see any sort of dividing down so assuming your SMCLK is sourced by the MCU frequency then it will be 25MHz.

    The period for 25MHz is 40ns, so a "count" by the timer happens every 40ns. In order to trigger a timer interrupt every 1ms, the timer would have to count up to 1ms/40ns which is 25,000 counts (TA0CCR0=25000). The value calculated would change based off of the interval wanted, speed of the clock, and the dividing down settings of the clock; but the basic steps to finding the value to put inside of TA0CCR0 are the same as I outlined above.

    Best regards,

    Matt Calvo

**Attention** This is a public forum