This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

240x中计算的问题



我用了库函数中的FC_PWM_DRV,即改变输入占空比,更新比较寄存器的值。源程序大概如下

PWMGEN pwm1;
pwm1.init();//默认m_period_max=1000;即T1PR=m_period_max=1000
pwm1.mfunc_c1=19660;//0.6(Q15格式)  pwm1占空比
pwm1.mfunc_c1=13107;//0.4(Q15格式)  pwm3占空比
pwm1.mfunc_c1=13107;//0.4(Q15格式)  pwm5占空比
pwm1.update();//计算的目的是调节占空比,不会改变周期值,但执行完之后T1PR改变了,T1PR=6;不知为何?