本帖最后由 dzguang 于 2012-6-7 10:29 编辑
相同的配置,(只是修改TIM2为TIM3)TIM3就是不能进入中断,获得捕获值,但是TIM2却可以,实在是不能理解
RCC->APB1ENR |= 3;
TIM2->ARR = 65535;
TIM2->PSC = 7;
TIM2->CR1 = 0;//向上计数
TIM2->CCER = 0;
TIM2->CCMR1 =0;
TIM2->CCMR1 |= 1;//CC1配置为输入,IC1映射在TI1上
TIM2->CCMR1 |= 1<<9;//CC2配置为输入,IC1映射在TI1上
TIM2->CCMR1 |= 1<<4;//不滤波
TIM2->CCMR1 |= 1<<2;//每次边检
TIM2->CCMR1 |= 1<<10;
TIM2->CCMR1 |= 1<<12;//不滤波
TIM2->CCER |= 0<<1;//上升沿
TIM2->CCER |= 3<<4;
TIM2->CCER |= 1;//捕获使能
TIM2->SMCR |= 5<<4;//滤波后TI1FP1
TIM2->SMCR |= 4;//从模式复位
TIM2->SMCR |= 1<<7;//触发输入
TIM2->CR1 |= 1;
TIM2->DIER |= 1<<2;//允许捕获中断 |