Below is my code where I need to do some business logic processing when a character / data at 2 UARTs arrives. But I am able to write dummy text to UARTs but not receive it via UARTs ISR:
#include <lpc214x.h> #define Fosc 12000000 #define Fcclk (Fosc * 5) #define Fcco (Fcclk * 4) #define Fpclk (Fcclk / 4) * 1 #define UART_BPS 9600 void delay(int a) { int j,i,k; for(k=0x00;k<1000;k++) { for(j=0x00;j<a;j++); for (i=0x00;i<a;i++); } } void usart0_string(unsigned char *data) { while(*data) // transmit only { U0THR = *data; while(!(U0LSR & 0X20)); data++; delay(15); } } void usart0_char(unsigned char temp) { U0THR = temp; while(!(U0LSR & 0X20)); delay(15); } void UART0_RXC() __irq { unsigned char temp; temp = U0RBR; usart0_char(temp); U0IER = 0x0001; VICVectAddr = 0; } void usart1_char(unsigned char temp) { U1THR = temp; while(!(U1LSR & 0X20)); delay(15); } void UART1_RXC() __irq { unsigned char temp; temp = U1RBR; usart1_char(temp); U1IER = 0x0001; VICVectAddr = 0; } void usart0_init() { unsigned int Baud16; PINSEL0 = 0x00000005; // selecting P0.0 & P0.1 for usart0 function PINSEL0 |= 0X0050000; U0FCR = 7; U1FCR = 7; U0LCR = 0X83; //DLAB = 1, stopbits =1, data length = 8bit U1LCR = 0X83; //DLAB = 1, stopbits =1, data length = 8bit Baud16 = (Fpclk / 16) / UART_BPS; U0DLM = Baud16 / 256; U0DLL = Baud16 % 256; U0LCR = 0X03; // clearing DLAB bit U1DLM = Baud16 / 256; U1DLL = Baud16 % 256; U1LCR = 0X03; // clearing DLAB bit VICIntSelect=0x00000000; U0IER = 0x0001; VICIntEnable |= 1 << 6; VICVectCntl0= (1<<5)|6; VICVectAddr0=(unsigned long) UART0_RXC; U1IER |= 1; //-- Enable UART1 peripheral interrupt VICIntEnable |= 1<<7; // UART1 interrupt enabled VICVectCntl1= (1<<5)|7; VICVectAddr1 = (unsigned long)UART1_RXC; // address of the ISR } int main() { usart0_init(); usart0_char('A'); usart0_char('B'); usart0_char('D'); usart0_char('F'); usart1_char('A'); usart1_char('B'); usart1_char('D'); usart1_char('F'); }