本帖最后由 hudiqi 于 2014-12-29 14:35 编辑
我用STM8S103F3做双路输入捕获,TIM1配置好并可以正常工作,但配置TIM2的时候发现一个问题,TIM2没有TIM2_SMCR。于是问题就出现了,配了很久出处还是不正常,请问高手怎么配置TIM2?
TIM1的配置如下:
CLK_PCKENR1 |= 0x80;
TIM1_PSCRH = 0;
TIM1_PSCRL = TIM1_DIV;
TIM1_CCMR1 |= 0x31; //fSAMPLING=fMASTER, N = 8;
//No prescaler, capture is made each time an edge is detected on the capture input;
//CC1 channel is configured as input, IC1 is mapped on TI1FP1;
TIM1_CCER1 &= ~0x02; //上升沿触发
TIM1_SMCR |= 0X54; //TI1FP1触发;复位模式
TIM1_CCER1 |= 0x01; //使能输入捕获1
TIM1_CR1 = 0x01; //Enabled update request source;Counter enabled;
|