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.

MSP430G2955 Input Capture TA0.1 Pin33

Hello just looking for some advise on why I can't get my input capture up and running, I am sure I am missing something here.

My problem is that the timmer interupt is never hit indicating that the setup of the capture compare is incorrect, or the CLK is wrong and messing thing up.

My CLK setup is to run off the DCO (tried bith the following methods

//CLK INIT routine -------------------------------------------------------------
void CLK_INIT()  
{
  //left stop modes out for now
  // Initialize DCO to 4.25Hz
 
  DCOCTL = DCO0 + DCO1;                //set DCO to 4.25MHz DCO = 3
 
  BCSCTL1 =  XT2OFF + RSEL3 + RSEL1 + RSEL0;   //XT2 off & DCO range declared as 4.25MHz RSEL = 11
   
  //DCOCTL = 0;                               // Select lowest DCOx and MODx settings
  //BCSCTL1 = CALBC1_8MHZ;                    // Set DCO to 8MHz
  //DCOCTL = CALDCO_8MHZ;
}
//------------------------------------------------------------------------------

The input capture setup is

//CAPCOM INIT routine ----------------------------------------------------------
void CAPCOM_INIT()
{
  TACTL = TASSEL_2 + ID_2 + MC_2 + TAIE;      // Initialise TPM1 to use SMCLK/4, Up mode & enable IRQ

  TACTL = TACTL & ~TAIFG;     //clear IRQ flag
 
  TACCTL1 = CM_2 + CAP + CCIE + SCS;      //falling edge input, capture mode, IRQ enabled
 
  TACCTL1 = TACCTL1 & ~CCIFG;      //clear IRQ flag
 
  P1SEL = P1SEL | BIT2;      //Port setup for input cap mode
  P1DIR = P1DIR & ~BIT2;    //Port is a input
 
  possible_preamble_flag = 0;
  preamble_count = 0;
  bit_counter = 0;
}
//------------------------------------------------------------------------------


and The interrupt I am using that never gets called is

// Timer A0 interrupt service routine ------------------------------------------
#pragma vector = TIMER0_A1_VECTOR

__interrupt void Timer0_A1 (void)

//------------------------------------------------------------------------------

Any help and advise would be apprecited.


Cheers Paul

  • That is not all of your code so before going into detail on the posted code lines: are you enabling the GIE bit as well?

    Dennis
  • Thanks Dennis, I know it would be something I had missed. The following as fixed the issue.

     void main(void)
    {
      DISABLE_IRQS();
     
      WDTCTL = WDTPW + WDTHOLD;
     
      P3DIR = BIT0 + BIT1; //LED outputs
     
      CLK_INIT();
      UART_INIT();
      CAPCOM_INIT();

      LED1_GREEN_ON;
      LED2_GREEN_ON;
     
      ENABLE_IRQS();

**Attention** This is a public forum