#include "NUC1xx.h"#include "Hal.h"#include "pwm.h"//wait current PWM cycle done, otherwise there maybe short pulse on FETvoid 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));}
标签:
pid
电机
bldc
上传时间:
2022-06-01
上传用户:kingwide