хочется, чтобы по приходу символа прога заскакивала в прерывание, но у меня почемуто заскакивает только после нескольхих символов и после этого все как срывается. прерывание вечное. есть подозрение. что я его неправильно сбрасываю. подскажите господа умные.
void Uart0Interrupt( void );
#pragma vector=IRQV
__irq __arm void irq_handler(void)
{
void (*interrupt_function)();
unsigned int vector;
vector = VICVectAddr; // Get interrupt vector.
interrupt_function = (void(*)())vector;
(*interrupt_function)(); // Call vectored interrupt function.
VICVectAddr = 0; // Clear interrupt in VIC.
}
void LPC21xxInitInterrupt( void )
{
// Assign all interrupt chanels to IRQ
VICIntSelect = 0;
// Diasable all interrupts
VICIntEnClear = 0xFFFFFFFF;
// Clear all software interrutps
VICSoftIntClear = 0xFFFFFFFF;
// VIC registers can be accessed in User or privileged mode
VICProtection = 0;
// Clear interrupt
VICVectAddr = 0;
// Clear address of the Interrupt Service routine (ISR) for non-vectored IRQs.
VICDefVectAddr = 0;
// Clear address of the Interrupt Service routine (ISR) for vectored IRQs.
VICVectAddr0 = \
VICVectAddr1 = \
VICVectAddr2 = \
VICVectAddr3 = \
VICVectAddr4 = \
VICVectAddr5 = \
VICVectAddr6 = \
VICVectAddr7 = \
VICVectAddr8 = \
VICVectAddr9 = \
VICVectAddr10 = \
VICVectAddr11 = \
VICVectAddr12 = \
VICVectAddr13 = \
VICVectAddr14 = \
VICVectAddr15 = 0;
// Disable all vectored IRQ slots
VICVectCntl0 = \
VICVectCntl1 = \
VICVectCntl2 = \
VICVectCntl3 = \
VICVectCntl4 = \
VICVectCntl5 = \
VICVectCntl6 = \
VICVectCntl7 = \
VICVectCntl8 = \
VICVectCntl9 = \
VICVectCntl10 = \
VICVectCntl11 = \
VICVectCntl12 = \
VICVectCntl13 = \
VICVectCntl14 = \
VICVectCntl15 = 0;
VICIntSelect &= ~(1<<VIC_UART0); // IRQ on UART0 line.
VICVectAddr1 = (unsigned long)Uart0Interrupt; // Channel 1 of VIC - UARTO interrupt
VICVectCntl1 = 0x20 | VIC_UART0; // Enable vector interrupt for UART0 on channel 1 and set his type.
VICIntEnable |= (1<<VIC_UART0); // Enable UART0 interrupt.
}
void Uart0Interrupt( void )
{
UART0WriteChar('*');
U0IIR = 0x00; // clear interrupt ID
VICVectAddr = 0; // Clear interrupt in VIC.
}
void UART_init( void )
{
// 115200
U0LCR = 0x83;
U0DLL = 40;
U0DLM = 0;
U0LCR &= ~0x80;
PINSEL0 |= 0x5;
U0FCR = 0x01;
U0IER = 0x01;
}
int main()
{
Frec_Init();
UART_init();
//UART0_Init(9600); // UART0
__disable_interrupt(); //Disable interrupts.
LPC21xxInitInterrupt(); //Setup interrupt controller.
__enable_interrupt(); //Enable interrupts.
UART0WriteChar('*');
while(1)
{
}
}