/* TIM4 configuration: PWM Input mode ------------------------
The external signal is connected to TIM4 CH2 pin (PB.07), //选择ch2口输入
The Rising edge is used as active edge,
The TIM4 CCR2 is used to compute the frequency value //捕获周期
The TIM4 CCR1 is used to compute the duty cycle value//捕获占空比
------------------------------------------------------------ */
TIM_ICInitStructure.TIM_Channel = TIM_Channel_2;
TIM_ICInitStructure.TIM_ICPolarity = TIM_ICPolarity_Rising;//上升沿捕获, TIM_ICInitStructure.TIM_ICSelection = TIM_ICSelection_DirectTI;//设置端口ch1 ch2 ch3 ch4分别对应寄
//存器 ccr1 ccr2 ccr3 ccr4
TIM_ICInitStructure.TIM_ICPrescaler = TIM_ICPSC_DIV1;
TIM_ICInitStructure.TIM_ICFilter = 0x0;
TIM_ICInitStructure.TIM_ICPolarity = TIM_ICPolarity_Rising;//上升沿捕获ch2通道对应寄存器ccr2 捕获上升沿的值,所以另一个ccr1对应就是下降沿捕获,如果对应寄存器配置相反的话捕获关系就相反了?我这样理解正确吗
|