// Set_All_GPIO_Quasi_Mode;
P12_Quasi_Mode;
P11_Quasi_Mode;
P10_Quasi_Mode;
P00_Quasi_Mode;
P01_Quasi_Mode;
P03_Quasi_Mode;
PWM0_P12_OUTPUT_ENABLE;
PWM1_P11_OUTPUT_ENABLE;
PWM2_P10_OUTPUT_ENABLE;
PWM3_P00_OUTPUT_ENABLE;
PWM4_P01_OUTPUT_ENABLE;
PWM5_P03_OUTPUT_ENABLE;
PWM_IMDEPENDENT_MODE;//¶ÀÁ¢Êä³öģʽ
clr_PWMTYP;
PWM_CLOCK_DIV_8;
PWMPH = 0x07;
PWMPL = 0xCF;
/**********************************************************************
PWM frequency = Fpwm/((PWMPH,PWMPL) + 1) <Fpwm = Fsys/PWM_CLOCK_DIV>
= (16MHz/8)/(0x7CF + 1)
= 1KHz (1ms)
***********************************************************************/
PWM0H = 0x00;
PWM0L = 0x00;
PWM1H = 0x00;
PWM1L = 0x00;
PWM2H = 0x00;
PWM2L = 0x00;
PWM3H = 0x00;
PWM3L = 0x00;
set_SFRPAGE; //PWM4 and PWM5 duty seting is in SFP page 1
PWM4H = 0x04;
PWM4L = 0xCF;
PWM5H = 0x04;
PWM5L = 0xCF;
clr_SFRPAGE;
//-------- PWM start run--------------
set_LOAD;
set_PWMRUN;
PWM配置例程里面配置了这里,我仿真运行,发现进入了set_SFRPAGE;之后,配置
PWM4H = 0x04;
PWM4L = 0xCF;
PWM5H = 0x04;
PWM5L = 0xCF;
,退出clr_SFRPAGE;之后,PWM4H PWM4L变为0了?!为什么会这样呢
|