我使用官网上的程序,进不了中断,什么问题呢?请大家指点啊。
void timer0 (void) interrupt 1 using 1
{
// Stop Timer 0, adjust the Timer 0 counter so that we get another
// in 10ms, and restart the timer.
TR0 = 0; // stop timer
TL0 = TL0 + (TIMER0_COUNT & 0x00FF);
TH0 = TH0 + (TIMER0_COUNT >> 8);
TR0 = 1; // start Timer 0
// Increment the timer tick. This interrupt should occur approximately every 10ms. So,
//the resolution of the timer will be 100Hz not including interrupt latency.
timer0_tick++;
}
void timer0_init (void)
{
EA = 0; // disables all interrupts
timer0_tick = 0;
TR0 = 0; // stops Timer 0
CKCON = 0x03; // Timer 0 using CLKOUT/12
TMOD &= ~0x0F; // clear Timer 0 mode bits
TMOD |= 0x01; // setup Timer 0 as a 16-bit timer
TL0 = (TIMER0_COUNT & 0x00FF); // loads the timer counts
TH0 = (TIMER0_COUNT >> 8);
PT0 = 0; // sets the Timer 0 interrupt to low priority
ET0 = 1; // enables Timer 0 interrupt
TR0 = 1; // starts Timer 0
EA = 1; // enables all interrupts