PID-小車類-基于Cortex-M0的BLDC電機驅動 - 免費下載
技術資料資源
文件大?。?1640 K
?? 溫馨提示:本資源由用戶 kingwide 上傳分享,僅供學習交流使用。如有侵權,請聯系我們刪除。
#include "NUC1xx.h"
#include "Hal.h"
#include "pwm.h"
//wait current PWM cycle done, otherwise there maybe short pulse on FET
void PWM_Stop(U8 ch)
{
switch(ch)
{
case PWM_CHANNEL_A:
PWMA->u32CNR1 = 0;
PWMA->u32CMR1 = 0;
while(PWMA->u32PDR1 != 0);
break;
case PWM_CHANNEL_B:
PWMA->u32CNR2 = 0;
PWMA->u32CMR2 = 0;
while(PWMA->u32PDR2 != 0);
break;
case PWM_CHANNEL_C:
PWMA->u32CNR3 = 0;
PWMA->u32CMR3 = 0;
while(PWMA->u32PDR3 != 0);
break;
default:
while(1);
}
PWMA->u32POE &= ~(1<<ch);
PWMA->u32PCR &= ~(1<<(ch*8));
}