定时器3设置成边沿捕获并且设置成主从模式
TIM_SelectOutputTrigger(TIM3, TIM_TRGOSource_OC1);
TIM_SelectMasterSlaveMode(TIM3, TIM_MasterSlaveMode_Enable);
定时器4设置成输入捕获并且设置成从模式
//3õê¼»ˉTIM4êäèë2¶»ñ2Îêy
TIM4_ICInitStructure.TIM_Channel = TIM_Channel_1; //CC1S=01 Ñ¡Ôñêäèë¶Ë IC1ó3éäμ½TI1éÏ
TIM4_ICInitStructure.TIM_ICPolarity = TIM_ICPolarity_BothEdge; //éÏéyÑØ2¶»ñ
TIM4_ICInitStructure.TIM_ICSelection = TIM_ICSelection_TRC; //ó3éäμ½TI1éÏ //TIM_ICSelection_DirectTI
TIM4_ICInitStructure.TIM_ICPrescaler = TIM_ICPSC_DIV1; //ÅäÖÃêäèë·ÖÆμ,2»·ÖÆμ
TIM4_ICInitStructure.TIM_ICFilter = 0x00;//IC1F=0000 ÅäÖÃêäèëÂË2¨Æ÷ 2»ÂË2¨
TIM_ICInit(TIM4, &TIM4_ICInitStructure);
TIM_SelectInputTrigger(TIM4, TIM_TS_ITR2);
TIM_SelectSlaveMode(TIM4, TIM_SlaveMode_Trigger);
TIM_ITConfig(TIM4,TIM_IT_Update|TIM_IT_CC1,ENABLE);//ÔêDí¸üDÂÖD¶Ï ,ÔêDíCC1IE2¶»ñÖD¶Ï (¶¨ê±Æ÷òç3ö¸üDÂÖD¶Ï£»2¶»ñÖD¶Ï)
TIM_Cmd(TIM4,ENABLE ); //ê1Äü¶¨ê±Æ÷4
我现在想做的是用TIM3的TI1F_ED信号作为TIM4的输入捕获信号。这个配置的现象是当TIM3有上升沿时才会触发一次TIM4的捕获,而TIM3的下降沿不能触发TIM4的捕获,TIM3的捕获是正常的。求大神解答一下
一周热门 更多>