之前只用过51单片机,编程的时候全是设定寄存器,现在接触STM32发现寄存器太多了,头大了三天。。。
之前一直对着103的资料设定407的定时器,但是这哥俩区别真是有的,一开始就进错了门,还想找对人?407输入捕获要把GPIO设定成复用模式,还要做管脚复用的映射,
`GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
GPIO_PinAFConfig(GPIOA, GPIO_PinSource2, GPIO_AF_TIM5);  `
进入`GPIO_PinAFConfig` 看看注释后才豁然开朗,原来要这么设置AF。
@brief Changes the mapping of the specified pin. 
 @param GPIOx: where x can be (A..I) to select the GPIO peripheral. 
 @param GPIO_PinSource: specifies the pin for the Alternate function. 
 This parameter can be GPIO_PinSourcex where x can be (0..15). 
 @param GPIO_AFSelection: selects the pin to used as Alternate function. 
 This parameter can be one of the following values: 
 @arg GPIO_AF_RTC_50Hz: Connect RTC_50Hz pin to AF0 (default after reset) 
 @arg GPIO_AF_MCO: Connect MCO pin (MCO1 and MCO2) to AF0 (default after reset) 
 @arg GPIO_AF_TAMPER: Connect TAMPER pins (TAMPER_1 and TAMPER_2) to AF0 (default after reset) 
 @arg GPIO_AF_SWJ: Conne

 
                   
                   
                   
                   本文详细介绍了STM32F407单片机的输入捕获配置过程,通过实例解析捕获输入的关键设置,帮助读者拨开迷雾,深入理解这一功能。
本文详细介绍了STM32F407单片机的输入捕获配置过程,通过实例解析捕获输入的关键设置,帮助读者拨开迷雾,深入理解这一功能。
           最低0.47元/天 解锁文章
最低0.47元/天 解锁文章
                           
                       
       
           
                 
                 
                 
                 
                 
                
               
                 
                 
                 
                 
                
               
                 
                 扫一扫
扫一扫
                     
              
             
                  
 被折叠的  条评论
		 为什么被折叠?
被折叠的  条评论
		 为什么被折叠?
		 
		  到【灌水乐园】发言
到【灌水乐园】发言                                
		 
		 
    
   
    
   
             
            


 
            