我现在希望可以产生定时中断,但要关闭比较时产生的中断。从手册上看只要修改DIER就行了,但是无论怎样操作,还是进入中断。 void start_timer3(unsigned long data_period,unsigned long data_low) { unsigned long data1=0,data2=0,data3=0; RCC->APB1ENR|=1<<1;//TIM3 clock enable TIM3->CR1&=0xfffe; TIM3->DIER=0x0001; TIM3->CCMR1 = 0x7400; TIM3->CCER = 0x0010; //T3 CH2 MY_NVIC_Init(3,0,TIM3_IRQn ,4); data1=(data_period>>16) &0x0000ffff; TIM3->PSC=data1; data2=data_period/(data1+1); data3=data_low/(data1+1); TIM3->ARR=data2; //periode TIM3->CCR2=data2-data3; TIM3->CR1|=0x01; } void TIM3_IRQHandler(void) { OSIntEnter(); if ((TIM3->SR & 0x0001) != 0) //0.91ms定时器 {// check interrupt source Y2++; TIM3->SR &= ~(1<<0); // clear UIF flag } if ((TIM3->SR & (1<<2)) != 0) {TIM3->SR &= ~(1<<2);Y3++;} OSIntExit(); } 我是从测Y2,Y3的波形来观察的,大家有什么方法让他只进入定时中断但不进入比较中断吗??? |