嗨,我正在尝试在 8051 的定时器 3 上设置溢出定时器中断。代码卡在中断例程中。我正在使用 2511F32 (wixel)
下面是中断设置代码:
{ ......
T3CTL |= 0xE0; // set prescaler to tick frequency / 128 (DIV) bits 7:5
T3CTL |= 0x04; // Clear counter value (CLR - bit 2)
T3CTL |= 0x00; // Timer mode set to free running (00) bits 1:0
T3CTL |= 0x08; // Enable overflow interrupt (OVFIM) bit 3
T3CCTL1 &= ~0x40; // disable timer compare interrupts
T3CCTL0 &= ~0x40; // disable timer compare interrupts
IEN1 |= 0x08; // Enable Timer 2 interrupts
T3CTL |= 0x10; // Start the timer (START - bit 4)
EN = 1;
......
}
这是中断例程代码
ISR(T3,0)
{
TIMIF &= ~0x07; // T3OVFIF Clear T3 overflow interrupt flag - bit 0
LED_YELLOW_TOGGLE();
}
它仍然被困在 ISR 例程中。没有其他要清除的中断标志。有任何想法吗 ?