void new_timer2_init(void)
{
TIMSK |= 0x80;
TCCR2 = 0x00; //stop
TCNT2 = 0x00; //setup
OCR2 =0x01;
TCCR2 = 0x19; //start
}
我没有开T/C2的溢出中断和比较中断
void timer0_init(void) //TCNT0 = 256 - (11059200 / 8)*0.001
{
TCCR0 = 0x00; //stop
ASSR = 0x00; //set async mode
TCNT0 = 0x54; //set count
OCR0 = 0xAC;
TCCR0 = 0x04; //start timer
EnableT0Int;
}
//----------------------------------------------------
void Timer0IntOverflow(void)
{
TCNT0 = 0x54; //reload counter value
g_lTimer++;
}
T/C0开了溢出中断,是用来定时控制灯的闪烁的,T/C2是用来输出方波的,我的主程序是先调用T/C0来控制灯的闪烁以判断系统是否死机,但是我一调用T/C2是灯就不闪烁了,请问高手,这是怎么回事?(用示波器看了T/C2输出的波形是正常的) |