This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LPC2100 UART ISR

hi,

i am new to ARM7, i tried a code to receive characters through serial port and process the character in the serial port ISR. the code is getting interrupted, but the control is not switched to the corresponding ISR.please help me through this.

here is my code

#include <stdio.h>
#include <lpc21xx.h>

void U1ISR(void)__irq; //Declare UART1 IRQ ISR

int data,clear,dummy;

void DefISR (void) __irq { ;
}

int main (void)
{

PINSEL0 = 0x00050000; /* Enable RxD1 and TxD1 */
IO1DIR = 0x00FF0000; /* P1.16..23 defined as Outputs */
IO1CLR= 0x00FF0000; /* turn off LEDs */

U1IER = 0; /* Disable UART1 Interrupts */
U1LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */
U1DLL = 97; /* 9600 Baud Rate @ 12MHz VPB Clock */
U1LCR = 0x03; /* DLAB = 0 */
U1FCR = 0x07; /*Enables and Resets FIFO, 1 byte */
dummy = U1IIR; /* Read IrqID - Required to Get Interrupts Started */
U1IER = 0x01; /*Enable the RDA interrupt*/

VICVectAddr0 = (unsigned long)U1ISR; //Set UART1 ISR Vector Address
VICVectCntl0 = 0x20 | 7; //Enable Slot, Set Channel 7
VICIntEnable = 0x80; //Enable Int UART1
VICDefVectAddr = (unsigned long) DefISR; // un-assigned VIC interrupts

while (1)
{

} //END OF WHILE LOOP
} // END OF MAIN LOOP

void U1ISR(void)__irq //UART1 ISR
{ clear=U1LSR; //UART Line Status Register
data = U1RBR; // UART Receiver Buffer Register
data<<=16;
IO1CLR=0x00FF0000;
IO1SET=data; /*Displaying the DATA on GPIO1*/
VICVectAddr = 0; /* Acknowledge Interrupt*/
return;
}

thank you.

0