新聞中心

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

stm8-MC KIT庫中的主動剎車

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

本文引用地址:http://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
}

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



關(guān)鍵詞: stm8-MCKIT庫主動剎

評論


相關(guān)推薦

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

關(guān)閉