Hi friends...i am doing project in LPC2148 series....i need to generate an interrupt for every 1sec...timer is working but the interrupt is not working..i.e., it is matched with vectored address...the interrupt is not being serviced...can anyone help me and say whats the mistake in my code..........
Here is the code:
#include<LPC214x.H>
void init_PLL(void);
void T0isr(void) __irq;
void T1isr(void) __irq;
float sine[71]={0.0,0.109,0.216,0.317,0.411,0.494,0.566,0.623,0.665,0.691,0.7,0.691,0.665,0.623,0.566,0.494,0.411,0.317,0.216,0.109,0.0,-0.109,-0.216,-0.317,-0.411,-0.494,-0.566,-0.623,-0.665,-0.691,-0.7,-0.691,-0.665,-0.623,-0.566,-0.494,-0.411,-0.317,-0.216,-0.109,0.0,0.109,0.216,0.317,0.411,0.494,0.566,0.623,0.665,0.691,0.7,0.691,0.665,0.623,0.566,0.494,0.411,0.317,0.216,0.109,0.0,-0.109,-0.216,-0.317,-0.411,-0.494,-0.566,-0.623,-0.665,-0.691,-0.7};
float a,b,c,t,x=0.01,incoper=0.01;
int i=0,flag=0,j,k,m,n,p,slope=5;
int main(void)
{
init_PLL();
IO1DIR=0x00FF0000;
//IO1SET=0x00030000;
T0IR=0x00000000;
T0PR=0x0000001E;
T0TCR=0x00000000;
T0MCR=0x00000003;
T0MR0=500;
T0TCR=0x00000001;
VICVectAddr4=(unsigned)T0isr;
VICVectCntl4=0x00000014;
T1IR=0x00000000;
T1PR=0x0000001E;
T1TCR=0x00000000;
T1MCR=0x00000003;
T1MR0=2;
T1TCR=0x00000001;
VICVectCntl0 = 0x0000002F;
VICVectAddr0 = (unsigned)T1isr;
VICIntEnable |=0x00000010;
//VICIntSelect=0xFFFFFFCF;
while(1)
{
if(i<20)
{
if(a<=t)
{
IO1SET=0x00010000;//m=1;
IO1CLR=0x00020000;
}
else
{
IO1CLR=0x00010000;
IO1SET=0x00020000;//m=0;
}
}
else
{
if(a>=t)
{
IO1SET=0x00010000;//m=1;
IO1CLR=0x00020000;
}
else
{
IO1CLR=0x00010000;
IO1SET=0x00020000;//m=0;
}
}
if(j<20&&j>40)
{
if(b<=t)
{
IO1CLR=0x00080000;
IO1SET=0x00040000;
//n=1;
}
else
{
IO1CLR=0x00040000;
IO1SET=0x00080000;
//n=0;
}
}
else
{
if(b>t)
{
//n=1;
IO1CLR=0x00080000;
IO1SET=0x00040000;
}
else
{
//n=o;
IO1CLR=0x00040000;
IO1SET=0x00080000;
}
}
if(k>40&&k<60)
{
if(c<=t)
{
//p=1;
IO1CLR=0x00200000;
IO1SET=0x00100000;
}
else
{
IO1CLR=0x00100000;
IO1SET=0x00200000;
//p=0;
}
}
else
{
if(c>t)
{
//p=1;
IO1CLR=0x00200000;
IO1SET=0x00100000;
}
else
{
//p=0;
IO1CLR=0x00100000;
IO1SET=0x00200000;
}
}
}
}
void T0isr(void) __irq
{
IO1SET=0x00800000;
i++;
j=i+13;
k=i+27;
a=sine;
b=sine[j];
c=sine[k];
if(i>40)
i=0;
T0IR |=0x00000001;
VICVectAddr=0x00000000;
}
void T1isr(void) __irq
{
t=slope*x;
IO1SET=0x00400000;
x=x+incoper;
flag++;
if((t<-4.9)&&(flag>48))
{
incoper=-1*incoper;
flag=0;
}
if((t>4.9)&&(flag>48))
{
incoper=-1*incoper;
flag=0;
}
VICVectAddr=0x00000000;
}
void init_PLL(void)
{
PLL0CFG=0X00000024;
PLL0CON=0X00000001;
PLL0FEED=0X0000000AA;
PLL0FEED=0X00000055;
while(!(PLL0STAT&0X00000400));
PLL0CON=0X00000003;
PLL0FEED=0X000000AA;
PLL0FEED=0X00000055;
VPBDIV=0X00000002;
}