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 Reply Children
  • 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 ]

    ****************************************************/
    #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) __irq
    {

    T2IR = 0x00000001; //Clear match 0 interrupt
    VICVectAddr = 0x00000000; //Dummy write to signal end of interrupt

    }

    thanks