void PWM_init(void ) { CKCON|=0x80;//使能内部高速晶体 P34F=5;//led P01F=5;//pwmir PWM3CON =2;//使用高速作为PWM时钟 PWM3CKD = 214;//214 PWM2CON =2;//使用高速作为PWM时钟 PWM2CKD =0; PWM3DIVH = 0x03;//16000000/1000/=500 PWM3DIVL = 0xeb;// PWM2DIVH = 0x03;//16/255/44=1.39K PWM2DIVL = 0xeb;// PWMEN |=0x0C; } void pwmled(u16 qq) { PWM2DUTH = qq>>8; // PWM2DUTL = qq; } void pwmir(u16 b) { PWM3DUTH = b>>8; // PWM3DUTL = b; }