新唐N76E885定时器配置问题,开机只进入一次中断,是哪里配置错了?
/**************************************************************************
* 函 数: TIMER0_Init
* 功能说明: TIMER0初始化
* 形 参:
* 返 回 值:
***************************************************************************/
void TIMER0_Init()
{
//Timer0设置推完输出模式
clr_P2M1_0;
set_P2M2_0;
System_Clock_Select(E_HIRCEN); //Fosc = 22.1184MHz Internal RC
TMOD = 0x00; //Timer 0 and Timer 1 mode configuration
u8TH0_Tmp = (8192-TH0_INIT)/32; //TIMER0计数器13位8192
u8TL0_Tmp = (8192-TL0_INIT)%32;
clr_T0M; //定时器0时钟选择1/12系统时钟
clr_T1M; //定时器1时钟选择1/12系统时钟
clr_TR1; //Timer1 stop
TH0 = u8TH0_Tmp;
TL0 = u8TL0_Tmp;
set_ET0; //enable Timer0 interrupt
set_EA; //enable interrupts
set_TR0; //Timer0 run
set_TR1;
}
/**************************************************************************
* 函 数: Timer0_ISR
* 功能说明: TIMER0中断函数
* 形 参:
* 返 回 值:
***************************************************************************/
void Timer0_ISR (void) interrupt 1 //interrupt address is 0x000B
{
// TH0 = TH0_INIT;
// TL0 = TL0_INIT;
if(TF0==1)
{
Timer_Sequence();
}
clr_TF0;
//P30 = ~P30; //P3.0 toggle when interrupt
//Period = 10.85/2 ms@XTAL=22.1184MHz
} |