- 积分
- -1
- 回帖
- 0
- 西莫币
-
- 贡献
-
- 威望
-
- 存款
-
- 阅读权限
- 0
- 最后登录
- 1970-1-1
该用户从未签到
|
悬赏10西莫币未解决
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);
|
|