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(TIM3, &TIM_ICInitStructure);
TIM_ICInitStructure.TIM_Channel = TIM_Channel_1;
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(TIM3, &TIM_ICInitStructure);
TIM_Cmd(TIM3, ENABLE);
TIM_ITConfig(TIM3, TIM_IT_CC2 | TIM_IT_CC1, ENABLE);
TIM_ITConfig(TIM3, TIM_IT_CC2, ENABLE);
TIM_ITConfig(TIM3, TIM_IT_CC1, ENABLE);
如果我使用黑字+蓝字的配置的话,通道2可以正常工作,通道1有问题;
如果我使用黑字+红字的配置的话,通道1可以正常工作,通道2有问题;而且问题和刚才通道1的问题一样,是不是加上通道1的设置之后,会覆盖通道2的设置?正确的设置是怎么样的?
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
第一种配置
TIM_ICInitStructure.TIM_Channel = TIM_Channel_2;
TIM_PWMIConfig(TIM3, &TIM_ICInitStructure);
TIM_ICInitStructure.TIM_Channel = TIM_Channel_1;
TIM_PWMIConfig(TIM3, &TIM_ICInitStructure);
这样配置ch1正常,ch2有问题
第二种配置
TIM_ICInitStructure.TIM_Channel = TIM_Channel_1;
TIM_PWMIConfig(TIM3, &TIM_ICInitStructure);
TIM_ICInitStructure.TIM_Channel = TIM_Channel_2;
TIM_PWMIConfig(TIM3, &TIM_ICInitStructure);
这样配置ch2正常,ch1有问题
问题一样,应该是一个把另一个覆盖了,怎么解决
一周热门 更多>