|
能解释一下标红处什么意思吗?PWM怎么控制开关的?
[复制链接]
void ComHandler(void)
{
TIM1->BKR &= (uint8_t)(~TIM1_BKR_MOE);//禁止PWM输出
PWM_A_OFF;
PWM_B_OFF;
PWM_C_OFF;
if(FaultF!=0||St_F==0)return;
if(bHallStartStep==0) //AB
{
TIM1->CCR1H = (uint8_t)(OutPwmValue >> 8);
TIM1->CCR1L = (uint8_t)(OutPwmValue);
PWM_B_ON;
}
else if(bHallStartStep==1) //AC
{
TIM1->CCR1H = (uint8_t)(OutPwmValue >> 8);
TIM1->CCR1L = (uint8_t)(OutPwmValue);
PWM_C_ON;
}
else if(bHallStartStep==2) //BC
{
TIM1->CCR2H = (uint8_t)(OutPwmValue >> 8);
TIM1->CCR2L = (uint8_t)(OutPwmValue);
PWM_C_ON;
}
else if(bHallStartStep==3) //BA
{
TIM1->CCR2H = (uint8_t)(OutPwmValue >> 8);
TIM1->CCR2L = (uint8_t)(OutPwmValue);
PWM_A_ON;
}
else if(bHallStartStep==4) //CA
{
TIM1->CCR3H = (uint8_t)(OutPwmValue >> 8);
TIM1->CCR3L = (uint8_t)(OutPwmValue);
PWM_A_ON;
}
else if(bHallStartStep==5) //CB
{
TIM1->CCR3H = (uint8_t)(OutPwmValue >> 8);
TIM1->CCR3L = (uint8_t)(OutPwmValue);
PWM_B_ON;
}
TIM1->CCER1=PWM_EN1_TAB[bHallStartStep];
TIM1->CCER2=PWM_EN2_TAB[bHallStartStep];
TIM1->BKR|=TIM1_BKR_MOE;//使能PWM输出
|
|