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.

关于MSP430FR5994的TA1.0 测量频率的问题

Other Parts Discussed in Thread: MSP430FR5994, MSPWARE

最近用MSP430FR5994的P2.4(TA1.0)测量频率,在捕获模式下发现无法进入timer1_A0的中断,以下是相关代码,请指正。(为了测试把P2.4脚改为下降沿中断的GPIO_EXTI模式,有信号产生)。

void TimerA1_Capture_Init(void)
{
P2DIR &= ~BIT4; // P2.4/TA1.0 Input Capture
//Set P2.4 as Secondary Module Function Input.
GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P2,GPIO_PIN4,
GPIO_SECONDARY_MODULE_FUNCTION);

//Start timer in continuous mode sourced by SMCLK
Timer_A_initContinuousModeParam initContParam = {0};
initContParam.clockSource = TIMER_A_CLOCKSOURCE_SMCLK;
initContParam.clockSourceDivider = TIMER_A_CLOCKSOURCE_DIVIDER_5;
initContParam.timerInterruptEnable_TAIE = TIMER_A_TAIE_INTERRUPT_DISABLE;
initContParam.timerClear = TIMER_A_DO_CLEAR;
initContParam.startTimer = false;
Timer_A_initContinuousMode(TIMER_A1_BASE, &initContParam);

//Initiaze capture mode
Timer_A_clearCaptureCompareInterrupt(TIMER_A1_BASE,
TIMER_A_CAPTURECOMPARE_REGISTER_0
);
Timer_A_initCaptureModeParam initCapParam = {0};
initCapParam.captureRegister = TIMER_A_CAPTURECOMPARE_REGISTER_0;
initCapParam.captureMode = TIMER_A_CAPTUREMODE_FALLING_EDGE;//下降沿触发
initCapParam.captureInputSelect = TIMER_A_CAPTURE_INPUTSELECT_CCIxA;
initCapParam.synchronizeCaptureSource = TIMER_A_CAPTURE_SYNCHRONOUS;
initCapParam.captureInterruptEnable =
TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE;
initCapParam.captureOutputMode = TIMER_A_OUTPUTMODE_OUTBITVALUE;
Timer_A_initCaptureMode(TIMER_A1_BASE, &initCapParam);

Timer_A_startCounter(TIMER_A1_BASE,
TIMER_A_CONTINUOUS_MODE
);
}
//******************************************************************************
//
//This is the TIMER1_A0 interrupt vector service routine.
//
//******************************************************************************
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=TIMER1_A0_VECTOR
__interrupt
#elif defined(__GNUC__)
__attribute__((interrupt(TIMER1_A0_VECTOR)))
#endif
void TIMER1_A0_ISR(void)
{
Timer_A_clearTimerInterrupt(TIMER_A1_BASE);
this_time = Timer_A_getCaptureCompareCount(TIMER_A1_BASE,
TIMER_A_CAPTURECOMPARE_REGISTER_0);
}