[table][tr][td]
不明白“ IC1的捕获寄存器捕获PWM的高电平周期”这句话在哪个里面体现了? 我只配置了通道2的输入捕获功能呀,为什么 通道1TIM_GetCapture1(TIM2)捕获了?<div class="blockcode"><div id="code_I8h">
- /* TIM2 configuration: PWM Input mode ------------------------
- The external signal is connected to TIM2 CH2 pin (PA.01),
- The Rising edge is used as active edge,
- The TIM2 CCR2 is used to compute the frequency value
- The TIM2 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;
- TIM_ICInitStructure.TIM_ICPrescaler = TIM_ICPSC_DIV1;
- TIM_ICInitStructure.TIM_ICFilter = 0x0;
- TIM_PWMIConfig(TIM2, &TIM_ICInitStructure);
- /* Select the TIM2 Input Trigger: TI2FP2 */
- TIM_SelectInputTrigger(TIM2, TIM_TS_TI2FP2);
- /* Select the slave Mode: Reset Mode */
- TIM_SelectSlaveMode(TIM2, TIM_SlaveMode_Reset);
- /* Enable the Master/Slave Mode */
- TIM_SelectMasterSlaveMode(TIM2, TIM_MasterSlaveMode_Enable);
- /* TIM enable counter */
- TIM_Cmd(TIM2, ENABLE);
- /* Enable the CC2 Interrupt Request */ TIM_ITConfig(TIM2, TIM_IT_CC2, ENABLE);
|