赞
踩
- RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM5,ENABLE);//使能 TIM5 时
- 钟
- 1. GPIO_InitStructure.GPIO_Pin=GPIO_Pin_0;//管脚设置
- 2. GPIO_InitStructure.GPIO_Mode=GPIO_Mode_IPD;//设置下拉输入模式
- 3. GPIO_Init(GPIOA,&GPIO_InitStructure); //初始化结构体
- void TIM_TimeBaseInit(TIM_TypeDef*TIMx,TIM_TimeBaseInitTypeDef*
- TIM_TimeBaseInitStruct);
- void TIM_ICInit(TIM_TypeDef* TIMx, TIM_ICInitTypeDef*
- TIM_ICInitStruct);
- 1. typedef struct
- 2. {
- 3. uint16_t TIM_Channel; //通道
- 4. uint16_t TIM_ICPolarity; //捕获极性
- 5. uint16_t TIM_ICSelection;//映射
- 6. uint16_t TIM_ICPrescaler;//分频系数
- 7. uint16_t TIM_ICFilter; //滤波器长度
- 8. } TIM_ICInitTypeDef;
TIM_OC1PolarityConfig(TIM5,TIM_ICPolarity_Faling);
TIM_ITConfig(TIM5,TIM_IT_Update|TIM_IT_CC1,ENABLE);
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。