This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LPC2103 -Timer interrupt problem

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

Parents
  • 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
    }

Reply
  • 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
    }

Children