TIM_ICInitTypeDef TIM_ICInitStructure; // 捕获通道IC1配置 // 选择捕获通道 TIM_ICInitStructure.TIM_Channel = TIM_Channel_1L; // //极性选择(上升还是下降或者双边) TIM_ICInitStructure.TIM_ICPolarity = TIM_ICPolarity_Rising; // 设置捕获通道的信号来自于哪个输入通道,有直连和非直连两种 TIM_ICInitStru...
TIM_ICInitTypeDef TIM_ICInitStructure; //定义结构体变量 TIM_ICInitStructure.TIM_Channel = TIM_Channel_1; //选择配置定时器通道1 TIM_ICInitStructure.TIM_ICFilter = 0x0F; //输入滤波器参数,可以过滤信号抖动 TIM_ICInitStructure.TIM_ICPolarity = TIM_ICPolarity_Rising; //极性,选择为上升沿触发捕获 TIM...
TIM_ICInitTypeDef TIM_ICInitStructure; //定义结构体变量 TIM_ICInitStructure.TIM_Channel = TIM_Channel_1; //选择配置定时器通道1 TIM_ICInitStructure.TIM_ICFilter = 0xF; //输入滤波器参数,可以过滤信号抖动 TIM_ICInitStructure.TIM_ICPolarity = TIM_ICPolarity_Rising; //极性,选择为上升沿触发捕获 TIM_...
GPIO_Init(GPIOA,&GPIO_InitStructure); GPIO_ResetBits(GPIOA, GPIO_Pin_1); GPIO_ResetBits(GPIOA, GPIO_Pin_2);//定时器初始化配置TIM_TimeBaseStructInit(&TIM_TimeBaseStructure); TIM_TimeBaseStructure.TIM_Period=0xFFFF;//计数器自动重装载值TIM_TimeBaseStructure.TIM_Prescaler =0;//预分频器值T...
TIM_ICInitTypeDef TIM_ICInitStructure; //---GPIO Init--- RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE); RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO , ENABLE); GPIO_PinRemapConfig(GPIO...
TIM_ICInitTypeDef TIM_ICInitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE); //使能PORTB时钟 RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM5,ENABLE); //TIM5 时钟使能 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1; //PA1 输入
} TIM_ICInitTypeDef; 1. 2. 3. 4. 5. 6. 7. 8. 9. 具体的代码为 TIM_ICInitTypeDef TIM2_ICInitStructure; TIM2_ICInitStructure.TIM_Channel = TIM_Channel_1; //选择输入端 IC1 映射到 TI1 上 TIM2_ICInitStructure.TIM_ICPolarity = TIM_ICPolarity_Rising; //上升沿捕获 ...
TIM_ICInitStructure.TIM_ICPrescaler = TIM_ICPSC_DIV1 输入模式下,捕获端口上的每一次边沿都触发一次捕获 TIM_ICPSC_DIV2 输入模式下,每2次事件触发一次捕获 TIM_ICPSC_DIV4 输入模式下,每4次事件触发一次捕获 TIM_ICPSC_DIV8 输入模式下,每8次事件触发一次捕获 ...
} TIM_ICInitTypeDef; 具体的代码为: TIM_ICInitTypeDef TIM2_ICInitStructure; TIM2_ICInitStructure.TIM_Channel = TIM_Channel_1; //选择输入端 IC1 映射到 TI1 上 TIM2_ICInitStructure.TIM_ICPolarity = TIM_ICPolarity_Rising; //上升沿捕获 TIM2_ICInitStructure.TIM_ICSelection = TIM_ICSelection_...
TIM_ICInitTypeDef TIM2_ICInitStructure;TIM2_ICInitStructure.TIM_Channel = TIM_Channel_2; //选...