为什么我配置Time1_CH2为强制为高会出现一个波形啊 ,设置PWM模式是正常的,
我只要把他强制高了他就会出现94.5HZ的波形
。这是为什么啊
void TIM1_Init(void)
{
//以下操作为互补输出配置
TIM1_CCMR1 = 0x68; //配置OC1M,PWM
TIM1_CCMR2 = 0x50; //强制高
TIM1_CCR1H = 0x00;
TIM1_CCR1L = 0x14; //配置OC1REF占空比50%
TIM1_CCR2H = 0x00;
TIM1_CCR2L = 0x14;
TIM1_ARRH = 0x00;
TIM1_ARRL = 0x28; //配置OC1REF信号频率200kHz
TIM1_DTR = 0x0A; //配置死去时间(10*62.5=625ns
TIM1_CCER1 = 0x15;
TIM1_BKR = 0x80; //配置MOE=1(使能OC和OCN输出),OSSR=0,OSSI=1(实现0C1REF++极性+死区模式)
TIM1_OISR = 0x20; /*配置OIS1=0(当MOE为0,一个死区时间后,OC1=0),OIS1N=1(当MOE为0,一个死区时间后
OC1N=1)*/
//以下操作为复位触发配置
TIM1_SMCR = 0x74; //TS[111],触发源为外部触发,触发模式为复位触发;
TIM1_ETR = 0x12; //ETP=0,触发为上升沿触发;分频系数8,滤波周期8;
TIM1_IER = 0x40; //使能触发中断
TIM1_CR1 = 0x01; //开定时器1
} |