1.我用的2.0V的固件库
void AdvanTIM_Configuration(void)
{
TIM_ICInitTypeDef TIM_ICInitStructure;
/* Selects the TI1 as clock for TIM1: the external clock is connected to TI1 input pin,
the rising edge is the active edge and no filter sampling is done (ICFilter = 0) */
TIM_TIxExternalClockConfig(TIM1, TIM_TS_TI1FP1, TIM_ICPolarity_Rising, 0);
/* TIM1 Input trigger configuration: External Trigger connected to TI1 */
TIM_SelectInputTrigger(TIM1, TIM_TS_TI1FP1);
TIM_SelectSlaveMode(TIM1, TIM_SlaveMode_External1);
/* TIM1 Input Capture TIM_Channel_4 Configuration */
TIM_ICInitStructure.TIM_Channel = TIM_Channel_4;
TIM_ICInitStructure.TIM_ICPolarity = TIM_ICPolarity_Rising;
TIM_ICInitStructure.TIM_ICSelection = TIM_ICSelection_DirectTI;
TIM_ICInitStructure.TIM_ICPrescaler = TIM_ICPSC_DIV1;
TIM_ICInitStructure.TIM_ICFilter = 7;
TIM_ICInit(TIM1, &TIM_ICInitStructure);
/*使能TIM1计数器*/
TIM_Cmd(TIM1, ENABLE);
/*使能TIM1 CC4中断请求*/
TIM_ITConfig(TIM1, TIM_IT_CC4, ENABLE);
}
2.我用定时器TIM2产生周期为1秒的PWM,然后直接将其连接到定时器TIM1的通道4上,用示波器观察正常
3.我在程序里实时读取捕获寄存器CCR4,让后通过液晶显示出来,发现其值随着计数器的值改变而实时改变,而不是每秒改变一次,但是观察发现 捕获中断的确是是每秒进入一次。