LLC 三相移相PWM产生原理分析
void MX_PWM_Stop(void)
{
//----------------------使用停止函数后会导致移相角度为60度----------------------------------------------------------------
#if 1
//------Tim1 PWM定时器初始化------------------
HAL_TIM_OC_Stop(&htim1,TIM_CHANNEL_1);
HAL_TIMEx_OCN_Stop(&htim1,TIM_CHANNEL_1);
HAL_TIM_OC_Stop(&htim1,TIM_CHANNEL_3);
HAL_TIMEx_OCN_Stop(&htim1,TIM_CHANNEL_3);
HAL_TIM_OC_Stop(&htim8,TIM_CHANNEL_2);
HAL_TIMEx_OCN_Stop(&htim8,TIM_CHANNEL_2);
//------Tim8 PWM定时器初始化-------------
HAL_TIM_OC_Stop(&htim8,TIM_CHANNEL_1);
HAL_TIMEx_OCN_Stop(&htim8,TIM_CHANNEL_1);
HAL_TIM_OC_Stop(&htim8,TIM_CHANNEL_3);
HAL_TIMEx_OCN_Stop(&htim8,TIM_CHANNEL_3);
HAL_TIM_OC_Stop(&htim1,TIM_CHANNEL_2);
HAL_TIMEx_OCN_Stop(&htim1,TIM_CHANNEL_2);
__HAL_TIM_SET_COUNTER(&htim1,T_PRD);
__HAL_TIM_SET_COUNTER(&htim8,0); //1200 CH3
#endif
}
加入停止定时器函数,输出波形得到改善。
void MX_PWM_Stop(void)
{
//----------------------使用停止函数后会导致移相角度为60度----------------------------------------------------------------
#if 1
//------Tim1 PWM定时器初始化------------------
HAL_TIM_OC_Stop(&htim1,TIM_CHANNEL_1);
HAL_TIMEx_OCN_Stop(&htim1,TIM_CHANNEL_1);
HAL_TIM_OC_Stop(&htim1,TIM_CHANNEL_3);
HAL_TIMEx_OCN_Stop(&htim1,TIM_CHANNEL_3);
HAL_TIM_OC_Stop(&htim8,TIM_CHANNEL_2);
HAL_TIMEx_OCN_Stop(&htim8,TIM_CHANNEL_2);
//------Tim8 PWM定时器初始化-------------
HAL_TIM_OC_Stop(&htim8,TIM_CHANNEL_1);
HAL_TIMEx_OCN_Stop(&htim8,TIM_CHANNEL_1);
HAL_TIM_OC_Stop(&htim8,TIM_CHANNEL_3);
HAL_TIMEx_OCN_Stop(&htim8,TIM_CHANNEL_3);
HAL_TIM_OC_Stop(&htim1,TIM_CHANNEL_2);
HAL_TIMEx_OCN_Stop(&htim1,TIM_CHANNEL_2);
__HAL_TIM_SET_COUNTER(&htim1,T_PRD);
__HAL_TIM_SET_COUNTER(&htim8,0); //1200 CH3
HAL_TIM_Base_Stop(&htim1);
HAL_TIM_Base_Stop(&htim8);
#endif
}