Part Number: MSP432P401R
我自己写的输入捕获要么乱进中断,要末进不去中断,要末计数错吴
Susan Yang:
请问能否详细说明一下?另外建议您先参考例程
https://www.ti2k.com/wp-content/uploads/ti2k/DeyiSupport_OtherMCU_node
Capture a number of periods of the VLO clock and store them in an array.
,
guochun qi:
我就时参考例程写的
,
guochun qi:
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);}
,
Susan Yang:
guochun qi 说:我自己写的输入捕获要么乱进中断,要末进不去中断
那能否说一下您想要具体实现什么功能?您现在使用的是开发板还是自制板?
另外请您以“插入–>代码”的形式上传代码,以便于阅读
,
feida wang:
先清除cov位,再把main里面的MAP_Interrupt_enableSleepOnIsrExit();删掉