新聞中心

EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > stm8-MC KIT庫(kù)中的主動(dòng)剎車

stm8-MC KIT庫(kù)中的主動(dòng)剎車

作者: 時(shí)間:2016-11-28 來(lái)源:網(wǎng)絡(luò) 收藏
剎車時(shí)間與剎車PWM可設(shè).

本文引用地址:http://m.butianyuan.cn/article/201611/322714.htm

剎車函數(shù)如下:

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
}

比較簡(jiǎn)單就是A上橋PWM,BC下橋全開(kāi).將電能轉(zhuǎn)為磁能,磁能之間互作用,實(shí)現(xiàn)主動(dòng)剎車.



評(píng)論


相關(guān)推薦

技術(shù)專區(qū)

關(guān)閉