Hi all,
I am using LPC2103,I had configured timer2[16 bit] and i had set it for MR0 match interrupt and reset the TC on match ,
It is working for the first time ,But second time it is not working [it is not going to the ISR routine]. I had configure to reset the interrut[IR] register in ISR.
Could some body help me regarding this.Is their any other addtional configuration which i need to do for continous interrupt?
i am working on simulation,
Thans in advance,Looking forward for replys.
Shanid
dear all,
Please find the test code which i have tested . Here at the first time when MRO maches it will give the interrupt and program will go to the ISR ,But when the second time MRO matches to TC it is not going to the ISR . One more thing which i noticed is that the IR register becomig high in 2nd time ,Still it is not going to the ISR
Is anybody faced this problem before ? Is their any mistakes which i have done here? Could any body enlight me for this problem
/**************************************************
Test APP- Timer 2
****************************************************/ #include<LPC2103.h> void ISR(void); int main(void) { int x=0;
T2PR = 0x00000005; //Load prescaler T2TCR = 0x00000002; //Reset counter and prescaler T2MCR = 0x00000003; //match reset the counter and generate an interrupt T2MR0 = 0x00000010; //cycle time T2TCR = 0x00000001; //enable timer
VICVectAddr4 = (unsigned)ISR; //Set the timer ISR vector address VICVectCntl4 = 0x0000003A; //Set channel control
VICIntEnable |= 0x04000000; //Enable the TIMER2 interrupt
while(1)
{ x=x+1; //Keeps loop running in single step }
}
void ISR (void) { T2IR = 0x0000000F; //Clear match 0 interrupt }
void ISR (void) __irq { T2IR = 0x0000000F; //Clear match 0 interrupt }
u have to add __irq to the isr function u try this way u will get it.....
thanks for your reply ,
i just tried the way which you told ,but still i am getting the same answer ,It is going to ISR only once .
void isr(void) __irq;
void isr(void) __irq { }
u sure u didnt got?...then go to disassembly check whether the actual isr is loaded into the corresponding registers.
also it is better to enable timer after configuring the interrupt
thank you shameel,
i got it ,I just enabled the interrupt after configuring the interrupt .
thank alot for your help, Thanks Shanid +91-8214003008
Here is the working code ,In ISR i have wrote one more line for writing an dummy to VECT.
Test APP- Timer 2[Code which has worked ]
void ISR (void) __irq {
T2IR = 0x00000001; //Clear match 0 interrupt VICVectAddr = 0x00000000; //Dummy write to signal end of interrupt
thanks