Part Number: MSP430F2272
Hi everyone.
I'm trying to measure the frequency of a square wave connected to P4.4 (TB1) port of a MSP430F2272 device. Frequency should be in the near 2MHz.
My clocks are configured as:
MCLK - 8 MHz
SMCLK - 8 MHz
ACLK - 1 MHz
Timer B configuration:
TBCTL = (CNTL_0 | TBSSEL_2 | ID_0 | MC_0 | TBIE); TBCCTL1 = (CM_1 | CCIS_1 | CAP | CCIE | SCS); TBCCTL1 &=~COV;
Timer B ISR:
#pragma vector=TIMER0_B1_VECTOR
__interrupt void Timer_B1(void)
{
switch( __even_in_range(TBIV,14) )
{
case 0: break; // No interrupt
case 2:
TB_Pulse0 = TB_Pulse1;
TB_Pulse1 = TBCCR1;
DayData[HourAD][HourQuarter][4] = (TB_Pulse1 - TB_Pulse0);
TBCCTL1 &= ~CCIFG;
break;
case 4: break; // CCR1 not used
case 6: break; // CCR3 not used
case 8: break; // CCR4 not used
case 10: break; // CCR5 not used
case 12: break; // CCR6 not used
case 14:
TBCCTL1 &= ~COV;
break;
default: break;
}
return;
}
All other interruptions are disabled!
My problem: The maximum frequency that I can correctly measure is at ~70KHz.
Any suggestions about what's wrong?