PWMLO = 0x55; //解锁
PWMPL= LOBYTE(204); //设置PWM周期Period = 204*(2/8.192us) = 50us
PWMPH= HIBYTE(204);
PWM1DL= LOBYTE(0); //设置PWM占空比Duty = 0
PWM1DH= HIBYTE(0);
PWMDT0L=0; //设置死区时间为1.2us = 10*(1/8.192us)
PWMINT |= Bin(10001000); //使能PWM中断,首次开启PWM中断会马上产生中断
tmp = PWMINT;
PWMINT |= Bin(00000100); //PWM启动后,马上将PWMS位置一再清零,能够有效滤掉尖峰毛刺
PWMEN |= Bin(00010010); //开启PWMP和PWMN输出
PWMEN |= Bin(10000000); //开启PWMP和PWMN输出
无法 开启PWMP和PWMN输出 PWMEN=0X12,手动改为PWMEN=0X92才可输出,就是PWMEN位写不了何解? |