设置TIM8的频率为800kHz,但是用示波器看实际输出的波形频率只有50Hz,有同志能指点一下吗?
TIM_TimeBaseStructure.TIM_Period = 90-1; // 800kHz
TIM_TimeBaseStructure.TIM_Prescaler = 0;
TIM_TimeBaseStructure.TIM_ClockDivision = 0;
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
TIM_TimeBaseInit(TIM8, &TIM_TimeBaseStructure);
TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM2; //
TIM_OCInitStructure.TIM_OutputNState = TIM_OutputNState_Enable; //
TIM_OCInitStructure.TIM_Pulse = 0;
TIM_OCInitStructure.TIM_OCNPolarity = TIM_OCNPolarity_Low; //
TIM_OCInitStructure.TIM_OCNIdleState = TIM_OCNIdleState_Reset;
TIM_OC2Init(TIM8, &TIM_OCInitStructure); //
TIM_OC2PreloadConfig(TIM8, TIM_OCPreload_Enable); //
TIM_ARRPreloadConfig(TIM8, ENABLE);
TIM_SetCompare2(TIM8,45);
TIM_CtrlPWMOutputs(TIM8,ENABLE);
TIM_Cmd(TIM8, ENABLE);
一周热门 更多>