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

LPC2129 never go to my ISR_ROUTINE onTIMER0! please help

Hi everybody!
I need some help.
I 'm trying to blink a led by using Timer0 and an IRQ Routine on a LPC2129.
I know my Timer work well (bit 0 in TOIR is generated about 900ms)
But I don't understand why it never launch my ISR routine.
I put a breakpoint and it never go there.

Maybe someone can help me to resolve it!
he would be nice!
Thank you.

#include <stdlib.h>
#include <LPC23xx.H>
#define Fpclk 12000000

char data;

void TIMER1_ISR(void) __irq {
        //VICSoftIntClear=0xFFFFFFFF;   //Clear all interrupts
        T0IR  = 0x01;           // set match 0
        T0TCR=0x03;                       //counter reset
        if(IOSET1==0x10000){
                IOCLR1 = 0x10000;
        }
        else if (IOCLR1==0x10000){
                IOSET1 = 0x10000;
        }
}


int main( void ){
        IODIR1 =  0x10000;

        //init VIC
        VICIntSelect=0x00000000; //all interupts: IRQ
        VICIntEnable=0xFFFFFFFF; //all interupts : enabled
        VICVectCntl4=0x00000014;//Uart interupt selected and enbled
        VICVectAddr4 = (unsigned long)TIMER1_ISR; //adress of the irq routine


        PCONP=0x02; //do not activate power saving
        T0MR0 = Fpclk - 1;                 // when T0TC arrived to 1 seconde (12000000 ticks) , the match between T0TC and T0MR0 do an interuption
        T0PR  = 0x00;            //1 incrementation every tick
         T0MCR = 0x07;           //stop ,reset,interuption enabled when timer 0 match to match0 */
        T0TCR = 0x01;                   //start counter


        while(1);
}

Parents
  • Yeah, it works well!!!
    Thanks "Per Westermark"
    i'm going to make a little sheduler now!

    here is my code:

    #include <LPC21xx.H>
    #define Fpclk 12000000
    
    void TIMER1_ISR(void) __irq {
    
            if(((IOPIN1&0x10000)>>16)==1){
                    IOCLR1 = 0x10000;
            }
            else if (((IOPIN1&0x10000)>>16)==0){
                    IOSET1 = 0x10000;
            }
            T0IR  = 0x01;           // set match 0
            VICVectAddr = 0xff;/* Dummy write to ACK the VIC */
    }
    
    
    int main( void ){
            IODIR1 =  0x10000;
    
            //init VIC
            VICIntSelect=0xFFFFFFEF; //TMR0 interupt: IRQ
            VICIntEnable=0x00000010; //TMR0 interupt : enabled
            VICVectCntl4=0x00000024;//timer interupt selected and enbled
            VICVectAddr4 = (unsigned long)TIMER1_ISR; //adress of the irq routine
    
    
            PCONP=0x02; //do not activate power saving
            T0MR0 = Fpclk - 1;                 // when T0TC arrived to 1 seconde (12000000 ticks) , the match between T0TC and T0MR0 do an interuption
            T0PR  = 0x00;            //1 incrementation every tick
            T0MCR = 0x03;           //stop ,reset,interuption enabled when timer 0 match to match0 */
            T0TCR = 0x01;                   //start counter
    
    
            while(1);
    }
    

Reply
  • Yeah, it works well!!!
    Thanks "Per Westermark"
    i'm going to make a little sheduler now!

    here is my code:

    #include <LPC21xx.H>
    #define Fpclk 12000000
    
    void TIMER1_ISR(void) __irq {
    
            if(((IOPIN1&0x10000)>>16)==1){
                    IOCLR1 = 0x10000;
            }
            else if (((IOPIN1&0x10000)>>16)==0){
                    IOSET1 = 0x10000;
            }
            T0IR  = 0x01;           // set match 0
            VICVectAddr = 0xff;/* Dummy write to ACK the VIC */
    }
    
    
    int main( void ){
            IODIR1 =  0x10000;
    
            //init VIC
            VICIntSelect=0xFFFFFFEF; //TMR0 interupt: IRQ
            VICIntEnable=0x00000010; //TMR0 interupt : enabled
            VICVectCntl4=0x00000024;//timer interupt selected and enbled
            VICVectAddr4 = (unsigned long)TIMER1_ISR; //adress of the irq routine
    
    
            PCONP=0x02; //do not activate power saving
            T0MR0 = Fpclk - 1;                 // when T0TC arrived to 1 seconde (12000000 ticks) , the match between T0TC and T0MR0 do an interuption
            T0PR  = 0x00;            //1 incrementation every tick
            T0MCR = 0x03;           //stop ,reset,interuption enabled when timer 0 match to match0 */
            T0TCR = 0x01;                   //start counter
    
    
            while(1);
    }
    

Children
No data