//初始化TIM8 Channel1 PWM?模式
TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM2; //
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable; //
//TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High; //
TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_Low; //
TIM_OC3Init(TIM8, &TIM_OCInitStructure); //
TIM_OC3PreloadConfig(TIM8, TIM_OCPreload_Enable); //
TIM_Cmd(TIM8, ENABLE); //
TIM_CtrlPWMOutputs(TIM8, ENABLE); // 设置TIM8的PWM输出为使能 TIM1和TIM8定时器需要加上这句
时间: 2024-10-15 09:12:30