各位大神,我在使用STM8S103f TIMER1输入捕获测量PWM波周期占空比时如下配置,但进不了中断,跪求指导啊
void init_TIM1_CH1(void)
{
TIM1_CCER1&=0xee;//禁止输入捕获1,2
TIM1_CCMR1|=0x01; //CC1通道被配置为输入,IC1映射在TI1FP1上
TIM1_CCER1&=~0x02; //CC1上升沿有效
TIM1_CCMR2|=0x02; //IC2映射在TI1FP2上
TIM1_CCER1|=0x20; //CC2下降沿有效
TIM1_SMCR|=0x54; //101:滤波后的定时器输入1(TI1FP1)100:配置触发模式控制器为复位触发模式
TIM1_IER|=0x06; //允许捕获中断
TIM1_CCER1|=0x11;//时能CC1E,CC2E捕获
TIM1_CR1=0x01; //使能计数器
} |