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.
请问能否详细说明一下?另外建议您先参考例程
https://dev.ti.com/tirex/explore/node?node=AG7JOJNuvDb6UGmBsWvn2Q__z-lQYNj__LATEST
Capture a number of periods of the VLO clock and store them in an array.
volatile uint_fast16_t Capture_Value=0;
Timer_A_ContinuousModeConfig continuousModeConfig=
{
TIMER_A_CLOCKSOURCE_SMCLK,
TIMER_A_CLOCKSOURCE_DIVIDER_1,
TIMER_A_TAIE_INTERRUPT_DISABLE,
TIMER_A_SKIP_CLEAR
};
Timer_A_CaptureModeConfig captureModeConfig =
{
TIMER_A_CAPTURECOMPARE_REGISTER_1,
TIMER_A_CAPTUREMODE_RISING_EDGE,
TIMER_A_CAPTURE_INPUTSELECT_CCIxA,
TIMER_A_CAPTURE_SYNCHRONOUS,
TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE,
TIMER_A_OUTPUTMODE_OUTBITVALUE,
};
void Capture_Base_Init(void)
{
MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P2,GPIO_PIN4,GPIO_PRIMARY_MODULE_FUNCTION);
MAP_Timer_A_initCapture(TIMER_A0_BASE, &captureModeConfig);
MAP_Timer_A_configureContinuousMode(TIMER_A0_BASE,&continuousModeConfig);
MAP_Interrupt_enableInterrupt(INT_TA0_N);
MAP_Interrupt_enableMaster();
MAP_Timer_A_startCounter(TIMER_A0_BASE,TIMER_A_CONTINUOUS_MODE);
}
void TA0_N_IRQHandler(void)
{
Timer_A_clearCaptureCompareInterrupt(TIMER_A0_BASE,TIMER_A_CAPTURECOMPARE_REGISTER_1);
// BITBAND_PERI(TIMER_A_CMSIS(TIMER_A0_BASE)->CCTL[1],TIMER_A_CCTLN_COV_OFS) = 0;//软件复位COV
Capture_Value=MAP_Timer_A_getCaptureCompareCount(TIMER_A0_BASE,TIMER_A_CAPTURECOMPARE_REGISTER_1);
}