刹车时刻与刹车PWM可设.
刹车函数如下:
void BrakeMotor( void )
{
u16 brake_pwm_cnt;
brake_pwm_cnt = (u16)(((u32)hArrPwmVal * BRAKE_DUTY) / 100);
ToCMPxH( TIM1->CCR1H, brake_pwm_cnt );
ToCMPxL( TIM1->CCR1L, brake_pwm_cnt );
ToCMPxH( TIM1->CCR2H, brake_pwm_cnt );
ToCMPxL( TIM1->CCR2L, brake_pwm_cnt );
ToCMPxH( TIM1->CCR3H, brake_pwm_cnt );
ToCMPxL( TIM1->CCR3L, brake_pwm_cnt );
//Disable update interrupt
TIM1->IER &= (u8)(~BIT0);
TIM1->CCMR1 = CCMR_PWM;
TIM1->CCMR2 = CCMR_LOWSIDE;
TIM1->CCMR3 = CCMR_LOWSIDE;
TIM1->CCER1 = (A_ON|B_COMP);
TIM1->CCER2 = C_COMP;
TIM1->EGR |= BIT5;
#ifdef LS_GPIO_CONTROL
LS_GPIO_BRAKE();
#endif
}
比较简单便是A上桥PWM,BC下桥全开.将电能转为磁能,磁能之间互效果,完成自动刹车.
声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/ziliao/sheji/255973.html