Sunday, 1 November 2015

TIMER0 MATCH INTERRUPT OF LPC2129/38(ARM7)

  #include<lpc21xx.h>
  void delay();
  __irq void timerint();
  int main()
  {
  IO0DIR=0XFFFFFFFF;
   T0TCR=1;
 
   T0TC=0X00000000;
  T0PR=1;
  T0MCR=0X003;
  T0MR0=0X0F00FFF;
   VICVectCntl0=0x24;
 
   VICIntEnable=0x00000010;
   VICVectAddr0=(unsigned)timerint;
  while(1);
 
  }
  __irq void timerint()
  {
 
  // T0TC=0X00000000;
  IO0SET=0XFFFFFFFF;
  delay();
  IO0CLR=0XFFFFFFFF;
  delay();
  T0IR=0X01;
  VICVectAddr=0;
  }
  void delay()
  {
  int i;
  for(i=0;i<100000;i++);
  }


No comments:

Post a Comment