我在配置N76E003的PWM遇到问题,发现波形不是一个完整的方形,而是从上升沿开始到顶峰需要一段时间,请问怎么配置才是不需要这个爬波的过程,下面是初始化代码:
{
PWM0_P12_OUTPUT_ENABLE;
PWM1_P11_OUTPUT_ENABLE;
PWM3_P00_OUTPUT_ENABLE;
PWM4_P01_OUTPUT_ENABLE;
PWM_IMDEPENDENT_MODE;
PWM_EDGE_TYPE;
// PWM_CENTER_TYPE;
/**********************************************************************
PWM frequency = Fpwm/((PWMPH,PWMPL) + 1) <Fpwm = Fsys/PWM_CLOCK_DIV>
= (16MHz/2)/(0x7CF + 1)
= 1KHz (1ms)
***********************************************************************/
PWM_CLOCK_DIV_2;
PWMPH = 0x2;
PWMPL = 0xcf; //3999+1
PWM0H = 0x00;
PWM0L = 0x00;
PWM1H = 0x00;
PWM1L = 0x00;
PWM3H = 0x00;
PWM3L = 0x00;
set_SFRPAGE; //PWM4 and PWM5 duty seting is in SFP page 1
PWM4H = 0x00;
PWM4L = 0x00;
clr_SFRPAGE;
//-------- PWM start run--------------
set_LOAD;
set_PWMRUN;
}
|