Interrupts + Keil + LPC2294 again...
2006-03-26 by grodo2k
Hello
I have a problem; the folowing code, allow to trigger an interrupt via
UART0 but when the interrupt occurs one time it doesn't end. When I
send a char from PC to the LPC I receive 'A' non stop. Can someone say
me, why?
When I use the line: U0IIR_copy = U0IIR;, it ackts same.
The code:
void UART0INT() __irq
{
if(toggle)
{
IO0CLR |= 0x20000; //clr P0.17
toggle = 0;
}
else
{
IO0SET |= 0x20000; //set P0.17
toggle = 1;
}
send_char_u0('A');
//exit ISR
//U0IIR_copy = U0IIR;
VICVectAddr = 0x00000000; //dummy write
}
int main(void)
{
PLL_ON();
LED_init();
VPBDIV = 0x1;
UART0_init();
IO0SET |= 0x20000; //set P0.17
send_string_u0(tab);
VICIntSelect = 0x00000000;
VICVectAddr1 = (unsigned) UART0INT;
VICVectCntl1 = 0x26; //UART0
VICIntEnable = 0x40; //bit 6 = UART0
U0IER = 0x00000001; //enable rx data available interrupt
while(1)
{
send_char_u0('B');
}
return 0;
}
P.S. Thanks to Andrew