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.

MSP430FR6972: TImer continous mode 's question

Part Number: MSP430FR6972

Hi,sir

I want to restart a new timing in the running timer at continous mode. For example, I set  timer B0.2 500ms timing , I want to stop it and restart a 20ms timing when timer B0.2 is running on the way to 500ms timing . how could I realize the function? I try to do it  as following :

 //timing 23.5ms
 TB0CCTL0 &= ~CCIE;                          
  TB0CCR0 = 2950;
  
 //timing 500ms
  TB0CCTL2 &= ~CCIE;
  TB0CCR2 = 62500;

  //smclk  continuous mode  125kHz
  TB0EX0 = TAIDEX_7;
  TB0CTL = TBSSEL__SMCLK | MC__CONTINUOUS| ID__8; 


  //TB0.2 interrupt
  case TB0IV_TB0CCR2: 
      
          TB0CCR2 += 62500;
                   
          //..
          //..execute some code
          //..
          if(temp1%2)
          {
          //I want to stop running 500ms timing,start a new B0.2 timing to 20ms
          TB0CCTL2 &= ~CCIE;
          TB0CCR2 = 2500; 
          TB0CCTL2 |= CCIE;
          }
          break;           
       

I found this is wrong ,It couldn't to restart a new 20ms timing .please help me solve the problem ,I will appreciate you very much.

  • Sorry about the code is don't show normally. the code is as following

    //timing 23.5ms
    TB0CCTL0 &= ~CCIE;
    TB0CCR0 = 2950;

    //timing 500ms
    TB0CCTL2 &= ~CCIE;
    TB0CCR2 = 62500;

    //smclk continuous mode 125kHz
    TB0EX0 = TAIDEX_7;
    TB0CTL = TBSSEL__SMCLK | MC__CONTINUOUS| ID__8;


    //TB0.2 interrupt
    case TB0IV_TB0CCR2:

    TB0CCR2 += 62500;

    //..
    //..execute some code
    //..
    if(temp1%2)
    {
    //I want to stop running 500ms timing,start a new B0.2 timing to 20ms
    TB0CCTL2 &= ~CCIE;
    TB0CCR2 = 2500;
    TB0CCTL2 |= CCIE;
    }
    break;
  • I did not understand your description.

    Please specifiy at which times you want to get interrupts.

**Attention** This is a public forum