将三路霍尔信号异或后连接到TI1,想要捕获异或后的信号的上升沿,但总是捕获成双边沿,求助
void TIM2_Configuration(void)//ͬ¶¨Ê±Æ÷3
{
TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; //»ù±¾½á¹¹Ìå±äÁ¿¶¨Òå
TIM_ICInitTypeDef TIM_ICInitStructure;
TIM_DeInit(TIM2);
TIM_TimeBaseStructure.TIM_Period =65535;
TIM_TimeBaseStructure.TIM_Prescaler = 35;
TIM_TimeBaseStructure.TIM_ClockDivision = 0; //TIM»ù±¾³õʼ»¯
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
TIM_TimeBaseStructure.TIM_RepetitionCounter = 0;
TIM_ARRPreloadConfig(TIM2, DISABLE);
TIM_TimeBaseInit(TIM2,&TIM_TimeBaseStructure);
TIM_ICInitStructure.TIM_Channel = TIM_Channel_1; //Ñ¡ÔñͨµÀ1
TIM_ICInitStructure.TIM_ICPolarity = TIM_ICPolarity_Rising ; //ÊäÈëÉÏÉýÑز¶»ñ
TIM_ICInitStructure.TIM_ICSelection = TIM_ICSelection_TRC; //ÅäÖÃͨµÀΪÊäÈ룬²¢Ó³Éäµ½ÄÄÀï
TIM_ICInitStructure.TIM_ICPrescaler = TIM_ICPSC_DIV1; //ÊäÈ벶»ñÔ¤·ÖƵֵ
TIM_ICInitStructure.TIM_ICFilter = 0; //ÊäÈëÂ˲¨Æ÷´ø¿íÉèÖÃ
TIM_ICInit(TIM2, &TIM_ICInitStructure);
TIM_SelectHallSensor(TIM2,ENABLE);
TIM_SelectInputTrigger(TIM2, TIM_TS_TI1F_ED ); //ÊäÈë´¥·¢Ô´Ñ¡Ôñ
// TIM_SelectSlaveMode(TIM2, TIM_SlaveMode_Reset); //´ÓģʽѡÔñ
TIM_ClearITPendingBit(TIM2,TIM_IT_CC1);
TIM_ITConfig(TIM2,TIM_IT_CC1, ENABLE); //¿ª¶¨Ê±Æ÷ÖжÏ
TIM_Cmd(TIM2,ENABLE);
} |