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.

MSP430, timer B7 will not run.

I have been working on a project that uses Timer B. It was all working well, for some unknown reason the counter stopped counting. After eliminating the hardware I went back to the eval board and tried to just make Timer B count up using  SMCLK. I made a simple Grace project and set the registers. Single stepping, TBR just sits at zero. This has to be something so simple but I can not find what I am missing. I am embarrassed to even ask for help with this.

This is what Grace created:

void Timer_B7_init(void)
{
/*
* TBCTL, Timer_B7 Control Register
*
* CNTL_0 -- 16-bit, TBR(max) = 0FFFFh
* TBSSEL_2 -- SMCLK
* ID_0 -- Divider - /1
* MC_1 -- Up Mode
*/
TBCTL = TBCLGRP_0 + CNTL_0 + TBSSEL_2 + ID_0 + MC_1;
}
Is there something else that's needs to be set in order to make the counter run?

  • Hello WayneB,

    i reproduced your issue and got the timer running with

    void Timer_B7_init(void)
    {
      TBCTL=0;
        /*
         * TBCTL, Timer_B7 Control Register
         *
         * CNTL_0 -- 16-bit, TBR(max) = 0FFFFh
         * TBSSEL_2 -- SMCLK
         * ID_0 -- Divider - /1
         * MC_1 -- Up Mode
         */
        TBCTL = TBCLGRP_0 + CNTL_0 + TBSSEL_2 + ID_0 + MC_1;

        
        TBCCR0=0xFFFF; // <- seems to init     TBxCL0 , choose value to count up to
    }

    Kind regards

    Marco

  • Thank you Marco,

    You are correct, it works for me as well.  I started the project in CCS4 and then upgraded to 5. I wonder if the Grace tool in 4 handled the config differently.

    To make Grace add this, you have to enter the value in the Timer Capture/Compare #0 , Capture Register field even though its not really being  used for anything else. 

    Thanks Again.

    Wayne

**Attention** This is a public forum