Saturday, 31 October 2015

TIMER0 CAPTURE INTERRUPT OF LPC2129/38(ARM7)

#include<lpc21xx.h>

void delay();
__irq void capint();
int main()
{
PINSEL0=0X00000020;
IO1DIR=0XFFFFFFFF;
T0TCR=1;
 T0CCR=0X05;
T0TC=0X00000000;

VICVectCntl0=0x24;
VICIntEnable=0x00000010;
VICVectAddr0=(unsigned)capint;
while(1);

}

__irq void capint()
{
IO1SET=0XFFFFFFFF;
delay();
IO1CLR=0XFFFFFFFF;
delay();
T0IR=0X10;
VICVectAddr=0;
}

void delay()
{
int i;
for(i=0;i<10000000;i++);
}

No comments:

Post a Comment