求助各位大侠
本人在用tiM1定时器实现互补PWM输出时,需要CH1通道产生PWM波形,互补通道CH1N 一直是高电平。
现在的问题是CH1通道能产生想要的PWM波形,可互补通道CH1N 一直是低电平,这里该怎么配置让它是高电平呢?求指点,非常感谢!
见如下图片?红色是我**的波形,实际上是下面的波形。
程序设置
TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_Timing;
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
TIM_OCInitStructure.TIM_OutputNState = TIM_OutputNState_Enable;
TIM_OCInitStructure.TIM_Pulse = CCR1_Val ; //ÉèÖÃÕ¼¿Õ±È
TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;
TIM_OCInitStructure.TIM_OCNPolarity = TIM_OCPolarity_High;
TIM_OCInitStructure.TIM_OCIdleState = TIM_OCIdleState_Set;
TIM_OCInitStructure.TIM_OCNIdleState = TIM_OCIdleState_Reset;
这个是PWM设置,在通信事件触发的情况下,
配置:
TIM_SelectOCxM(TIM1, TIM_Channel_1, TIM_OCMode_PWM1);
TIM_CCxCmd(TIM1, TIM_Channel_1, TIM_CCx_Enable);
TIM_CCxNCmd(TIM1,TIM_Channel_1, TIM_CCxN_Disable);
|