Friday, 30 October 2015

UART INTERRUPT OF LPC2129/38(ARM7)

#include<lpc21xx.h>

__irq void uartint(void);
void delay(void);
int main()
{IO1DIR=0XFFFFFFFF;
PINSEL0=0X00000004;
U0LCR=0X83;
U0DLM=0X00;
U0DLL=0X51;
U0LCR=0X03;
U0IER=0X01;

VICVectAddr0=(unsigned)uartint;
 VICIntSelect=0x00000000;
VICIntEnable=0x00000040;
VICVectCntl0=0x00000026;

  while(1)
  {
   delay();
  }
  }
 __irq void uartint()
 {
   U0IIR=0X04;
  IO1SET=0XFFFFFFFF;
  delay();
  IO1CLR=0XFFFFFFFF;
  delay();
  //U0IER=0X01;
  
   VICVectAddr=0;
  }
  void delay()
  {
  int i;
  for(i=0;i<1000000;i++);
  }

No comments:

Post a Comment