2019-07-14 17:09发布
60user90 发表于 2018-10-3 09:04 高级定时器都有正交编码功能,可参考F0xx或F1xx的库
60user16 发表于 2018-10-3 09:19 正交编码实在厉害,误差基本为零了
最多设置5个标签!
TIM_DeInit(TIM3);
TIM_TimeBaseStructInit(&TIM_TimeBaseStructure);
TIM_TimeBaseStructure.TIM_Prescaler = 0x0;
TIM_TimeBaseStructure.TIM_Period = 65535 - 1;
TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1;
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure);
TIM_EncoderInterfaceConfig(TIM3, TIM_EncoderMode_TI1,TIM_ICPolarity_Falling, TIM_ICPolarity_Falling);
TIM_ICStructInit(&TIM_ICInitStructure);
TIM_ICInitStructure.TIM_ICFilter = 15;
TIM_ICInit(TIM3, &TIM_ICInitStructure);
// 清除所有未决中断
TIM_ClearFlag(TIM3, TIM_FLAG_Update);
TIM_ITConfig(TIM3, TIM_IT_Update, DISABLE);
TIM3->SR = 0xfffe;
TIM_Cmd(TIM3, ENABLE);
~~谢谢~~
看了些开发板的资料,好像没讲过这方面的,过来请教下大神
一周热门 更多>