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.

Timer_A TACLK

Other Parts Discussed in Thread: MSP430F2272

Hey

Using: MSP430F2272

How do I get a externel 17KHz to clock my timerA0 ?

When I get a interrupt from timer B I would like to read the timerA register.

Can someone help ?

Thanks.

Best regards Michael

 

#pragma vector = TIMERB0_VECTOR
__interrupt void TIMERB0_ISR (void)
{
 
static int postimer;
 postimer = TAR;//TACCR0;
 
 TACTL |= TACLR; //CLEAR TIMER_A TAR

}

// Timer A0 interrupt service routine
 #pragma vector=TIMERA0_VECTOR
 __interrupt void Timer_A (void)
 {
  }

void main()

{

P1DIR |= 0x00;
P1OUT = 0x00;

P1SEL = 0x00;

TBCCTL0 = CCIE;
TBCTL = TBSSEL_2 + MC_2;

TACTL = TASSEL_0 + MC_1; //TACLK CONT MODE

TACCTL0 = CM_3 + CCIS_2 + CAP; //POS&NEG CAPTURE

 _BIS_SR(LPM0_bits + GIE); // Enter LPM0 w/ interrupt

while(1){}

}

  • Michael Hansen said:
    How do I get a externel 17KHz to clock my timerA0 ?

    Enable the external input clock source (TA0CLK), configure the proper pin (depends on the MSP, see the pin funcitons table in the datasheet) for module use with PxSEL.y and as input with PxDIR.y

    Then TimerA will count the external clock pulses.

    To capture the current TAR value based on TimerB, set up TBCCRx to emit a pulse in compare mode at a certain point fo TBR (see TiermB compare mode and PWM creation/output modes). Then route this signal to a TimerA CCR unit input and use this unit in capture mode.

    So once TimerB causes the output of its CCR to go low (or high, it's a configuraiton issue), the TimerA CCR will capture the current count of TAR into the TACCRx register and optionally trigger an interrupt. On some MSPs, there are even internal connections between some TimerB and TimerA signals (or you can remap the signals to the same port pin using hte port mapping controller, if available). But usually you'll need an external connection for this.

**Attention** This is a public forum