- Tue Nov 13, 2007 8:29 am
#37970
Hey, any help with this problem will be greatly appreciated.
I am trying to measure frequencies in the range of 300-600kHz with the MSP430F2274 using capture mode in Timer A. As of now I am able to measure up to 400kHz by just interrupting on each rising transition and recording TACCR0 to a variable. Later, out of the interrupt I convert the time between capture numbers to frequency. I'm sure many are familiar with this.
I have my clock running at the full 16MHz, it seems that with higher clock frequencies, the higher speeds I am able to read since the interrupt is able to finish in a shorter amount of time before the next interrupt.
Is there a way to maybe do some sort of pulse counting so the interrupt happens every other rise-time? My PCB has already been fabricated so I can't add any additional hardware to divide the frequency.
Here is my current ISR and timer A register values:
TACCTL0 |= CM_1 + SCS + CCIS_0 + CAP + CCIE;
TACTL |= TASSEL_2 + MC_2;
_BIS_SR(LPM0_bits + GIE);
#pragma vector=TIMERA0_VECTOR
__interrupt void TimerA0(void)
{
capture_array[i++] = TACCR0; //stores TACCR0 to a new array location
if(i == 2)
{
TACCTL0 &= ~CCIE;
LPM0_EXIT;
}
}
thanks in advance.
I am trying to measure frequencies in the range of 300-600kHz with the MSP430F2274 using capture mode in Timer A. As of now I am able to measure up to 400kHz by just interrupting on each rising transition and recording TACCR0 to a variable. Later, out of the interrupt I convert the time between capture numbers to frequency. I'm sure many are familiar with this.
I have my clock running at the full 16MHz, it seems that with higher clock frequencies, the higher speeds I am able to read since the interrupt is able to finish in a shorter amount of time before the next interrupt.
Is there a way to maybe do some sort of pulse counting so the interrupt happens every other rise-time? My PCB has already been fabricated so I can't add any additional hardware to divide the frequency.
Here is my current ISR and timer A register values:
TACCTL0 |= CM_1 + SCS + CCIS_0 + CAP + CCIE;
TACTL |= TASSEL_2 + MC_2;
_BIS_SR(LPM0_bits + GIE);
#pragma vector=TIMERA0_VECTOR
__interrupt void TimerA0(void)
{
capture_array[i++] = TACCR0; //stores TACCR0 to a new array location
if(i == 2)
{
TACCTL0 &= ~CCIE;
LPM0_EXIT;
}
}
thanks in advance.