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.

Parents
  • Before just trying random code, you should be sure that you have at least a basic understanding of how it's supposed to work, and what it's intended to do.

    Have you studied the Datasheet and/or User Manual and other supporting documentation for this particular chip?
    Do you understand how the interrupt mechanism works, and what your service routine needs to do?

    One thing you certainly didn't study is the instructions on this forum for how to post source code:

    www.danlhenry.com/.../keil_code.png

    If you missed something as clearly stated as that, it is possible that you have also missed other important details in the chip's documentation...

    "code is getting interrupted, but the control is not switched to the corresponding ISR"

    So what is happening, then?

Reply
  • Before just trying random code, you should be sure that you have at least a basic understanding of how it's supposed to work, and what it's intended to do.

    Have you studied the Datasheet and/or User Manual and other supporting documentation for this particular chip?
    Do you understand how the interrupt mechanism works, and what your service routine needs to do?

    One thing you certainly didn't study is the instructions on this forum for how to post source code:

    www.danlhenry.com/.../keil_code.png

    If you missed something as clearly stated as that, it is possible that you have also missed other important details in the chip's documentation...

    "code is getting interrupted, but the control is not switched to the corresponding ISR"

    So what is happening, then?

Children
More questions in this forum