但是可以产生匹配中断,以下是一部分代码,全局中断已经打开 #pragma interrupt_handler IRQ_TIMER2:10 void InitTime2(void) { //TIMER2 TCCR2 = 0x00; //停止计时 TCNT2 = 0xA2; // OCR2 = 0xd1; TCCR2 =(1<<WGM21)|(1<<WGM20)|(1<<COM21); TCCR2 |=(1<<CS21); //start Timer 1MHZ TIMSK |= 0x40; //溢出中断 } void IRQ_TIMER2(void) { TCNT2 = 0xA2; } |