用stm32的tim1做PWM输出,驱动三相无刷无传感器电机,参考了ST历程里面的7PWM_Output,PWM输出正常。现在在换相函数里面需要将PWM输出的4路关闭,置高电平,另外两路输出PWM,但是现在用下面的代码关闭不需要的4路PWM时,只能置低电平,请教该怎么改动才能在关闭以后默认输出高电平 void PhaseCharge() {
if (step == 1) { TIM_CCxCmd(TIM1, TIM_Channel_1, TIM_CCx_Enable); TIM_CCxNCmd(TIM1, TIM_Channel_1, TIM_CCxN_Disable);
TIM_CCxCmd(TIM1, TIM_Channel_2, TIM_CCx_Disable); TIM_CCxNCmd(TIM1, TIM_Channel_2, TIM_CCxN_Disable);
TIM_CCxCmd(TIM1, TIM_Channel_3, TIM_CCx_Disable); TIM_CCxNCmd(TIM1, TIM_Channel_3, TIM_CCxN_Enable); step++; . . . . . |