使用166A中,PWM0通道可以正常输出PWM波,但是PWM01,也就是那个互补通道死活调不出,没有任何脉冲出来,请大侠出招,谢谢!
IO端口初始化:
P0 = 0xfd;
P0CR = 0x2f;
P0PCR = 0xc0;
PWM初始化:
PWMLO = 0x55;
PWMEN = 0x09; // PWM0使能
PWMEN1 = 0x00;
PWM0C = 0x00;
PWM0PL = 0xff; // 周期4096
PWM0PH = 0x0f;
PWM0DL = 0xff; // 默认1/2占空比(临时设置,实际后期调整)
PWM0DH = 0x07;
PWM0DT = 0x00; |