unsigned int ZHANKONGBI = 50;
PWMB_PSCR = 0x00;
PWMB_PS = 0x04;
PWMB_CCER1 = 0x00
PWMB_CCMR2 = 0x68;
PWMB_CCER1 = 0x33
PWMB_ENO = 0x04;
PWMB_BKR = 0x80;
PWMB_CR1 = 0x01;
PWMB_ARR = 299;
PWMB_CCR6 = 150;
PWMB_ARR = 30000000L / PINLU - 1;
PWMB_CCR6 = (PWMB_ARR / 90) * ZHANKONGBI; //错
现在问题是频率在100KHz时占空比是50%,调整输出频率到110KHz时占空比变成了55%,90KHz时变成45%。如何固定占空比,只有调整占空比时才改变?就是PWMB_CCR6的跟随公式?
|