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

interrups not working properly

hi,
I am new to implementing interrupts and arm 7 as well.
I have just tried one example after reading the manual as well as some post.
I have few questions about the register values.
1)How do we get the value of VICVectCntl?I read the document but it's not clear.Please can someone explain me..
VICVectCntl1 = 0x20 | 7;

2)My code ehoes the character i enter on serial port uart1 but after the character it keeps on echoing 00
eg: 06 00 00..
and i see when i debug that it executes putchar_uart1()
indefinately and does not echoes any othe character i type after the first one.
Please any suggestions would help me

//main.c
#include <stdio.h>
#include <RTL.h>
#include <LPC214x.H>
int main(void)
{
init_serial1();
printf("testing \n");
while(1);
}
//end of main

//serial.c
void init_serial1 (void)  {

  PINSEL0 = 0x00050000;
  U1LCR = 0x83;
  U1DLL = 8;         //115200 baudrate
  U1LCR = 0x03;

  /* set up the interrupts */
U1IER = 0x05;   //
VICVectAddr1 = (unsigned long) u1_interrupt;   /* set interrupt vector */
VICVectCntl1 = 0x20 | 7;
VICIntEnable = 0x00000080;   /* enable uart1 interrupts */

}

void u1_interrupt (void)
{
 char intrpt;
 intrpt = U1RBR;
 putchar_uart1( intrpt );
 U1IER = 0x00;
 VICVectAddr = 0;   /* acknowledge interrupt */
}//end u1_interrupt()

int putchar_uart1(int ch)
{
  while (!(U1LSR & 0x20));
  return (U1THR = ch);
}

Parents Reply Children