我用的是单片机型号是pic18f46k80,最近输出100k的pwm波,发现前100个脉冲周期是40us,之后的pwm周期才是10us,有没有遇到过类似问题,求大神指教。
fosc为64M
配置如下:
PR2 = 159;
CCPR4L = 80; //Vout PWM duty low nibble
CCP4CONbits.DC4B = 0; // PWM duty high 2 nibble
CCP4CONbits.CCP4M = 12; //PWM mode
CCPTMRSbits.C4TSEL = 0; // CCP2 select timer2
T2CONbits.T2CKPS0 = 0; // Timer2 Clock Prescale 1:4
T2CONbits.T2CKPS1 = 0; // Timer2 Clock Prescale 1:4
T2CONbits.T2OUTPS = 0; // Timer2 Out Prescale 1:1
T2CONbits.TMR2ON = 1; // Timer2 On bit
|