stm32中定时器占空比=Pulse/Period,速度与占空比成正比。在Periode不变的情况下,应该Pulse值越大,速度越大;可是我的却是Pulse越小,速度越大,请问是为什么,非常感谢!
TIM_TimeBaseStructure.TIM_Prescaler = 3 - 1; TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_CenterAligned2 TIM_TimeBaseStructure.TIM_Period = 750-1; TIM_TimeBaseStructure.TIM_ClockDivision = 0;
TIM_TimeBaseStructure.TIM_RepetitionCounter = 0;
TIM_TimeBaseInit(TIM1,&TIM_TimeBaseStructure);
TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM2; TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Disable;
TIM_OCInitStructure.TIM_OutputNState = TIM_OutputNState_Disable;
TIM_OCInitStructure.TIM_Pulse = 5;
TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High; TIM_OCInitStructure.TIM_OCNPolarity = TIM_OCNPolarity_High;
TIM_OCInitStructure.TIM_OCIdleState = TIM_OCIdleState_Set;
TIM_OCInitStructure.TIM_OCNIdleState = TIM_OCIdleState_Reset;
TIM_OC1Init(TIM1,&TIM_OCInitStructure);
|