-
GD32F305VG timer0输入捕获无反应
各位大佬好!我按照GD32F30x的标准库配置了GD32F305VG的timer0定时器并开启了输入捕获功能,配置代码如下:voidtimer_config(void){/*-----------------------------------------------------------------------timer_parameter_structtimer_initpara;timer_ic_parameter_structtimer_icinitpara;rcu_periph_clock_enable(RCU_TIMER0);timer_deinit(TIMER0);/*NVICconfig*/nvic_irq_enable(TIMER0_UP_TIMER9_IRQn,1,1);nvic_irq_enable(TIMER0_Channel_IRQn,1,0);/*TIMER0configuration*/timer_initpara.prescaler=119;timer_initpara.alignedmode=TIMER_COUNTER_EDGE;timer_initpara.counterdirection=TIMER_COUNTER_UP;timer_initpara.period=999;timer_initpara.clockdivision=TIMER_CKDIV_DIV1;timer_initpara.repetitioncounter=0;timer_init(TIMER0,&timer_initpara);timer_icinitpara.icpolarity=TIMER_IC_POLARITY_RISING;timer_icinitpara.icselection=TIMER_IC_SELECTION_DIRECTTI;timer_icinitpara.icprescaler=TIMER_IC_PSC_DIV1;timer_icinitpara.icfilter=0x0;timer_input_capture_config(TIMER0,TIMER_CH_0,&timer_icinitpara);timer_input_capture_config(TIMER0,TIMER_CH_3,&timer_icinitpara);/*auto-reloadpreloadenable*/timer_auto_reload_shadow_enable(TIMER0);timer_interrupt_flag_clear(TIMER0,TIMER_INT_FLAG_CH0);timer_interrupt_flag_clear(TIMER0,TIMER_INT_FLAG_CH3);timer_interrupt_enable(TIMER0,TIMER_INT_CH0);timer_interrupt_enable(TIMER0,TIMER_INT_CH3);timer_interrupt_enable(TIMER0,TIMER_INT_UP);timer_enable(TIMER0);}/*中断服务程序*/voidTIMER0_UP_TIMER9_IRQHandler(void){if(timer_interrupt_flag_get(TIMER0,TIMER_INT_FLAG_UP)!=RESET){timer_interrupt_flag_clear(TIMER0,TIMER_INT_FLAG_UP);timer0tick++;}}voidTIMER0_Channel_IRQHandler(){if(timer_interrupt
2021-04-25 15