problem LPC2148 VIC IRQ request

Hi

the code given below needs to run the ISR when a cpature event occurs.
But on simulating the code and running it on debugger it doesnot switch to irq mode and hence does not go to ISR for that event.

I have tried running the simplest IRQ code given in hitex.pdf.
Even in that case irq ISR is not executed.

can someone please help with this.

Thanks in advance

#include <LPC21xx.H>                       /* LPC21xx definitions */

void T0isr()__irq;


 int main (void) {

        VPBDIV=0x2;
        PINSEL1=0x2000;
         IODIR0=0x0;
         IODIR1=0xff0000;

         T0TCR=0x2;
         T0CCR=0x7;
         T0TCR=0x00;

         VICIntSelect=0x0;
         VICIntEnable=0x10;
         VICVectCntl0=0x24;


          VICVectAddr0=(unsigned long)T0isr;
          T0TCR=0x01;
         while(1);


}

void T0isr()__irq
{
static int value;

        value=T0CR0;
        T0IR=0x1;

         IODIR1 = 0x00FF0000;


      IOSET1 = 0xffff;

        VICVectAddr=0x00;
}




Parents
  • I can see that you have:

        IODIR1 = 0x00FF0000;
        IOSET1 = 0xffff;
    


    Reading the user manual for the processor, I see that a '1' sets a pin as output.
    So you set:
    P1.0..P1.15 as inputs
    P1.16..P1.23 as outputs
    P1.24..P1.31 as inputs.

    Then you decide to set P1.0..P1.15 high - but you just informed the processor that the pins are inputs...

    How many other interesting things do you have in your code?

    Maybe you should spend some time with the user manual for the processor. Check every single line - and add proper comments. Right now, it seems like the comment "/* LPC21xx definitions */" got there by accident.

    Come back when you have scanned every single source code line and it seems to match the processor documentation. But this time, you could decide to skip the bold feature. It really isn't meaningful to make the full post bold...

Reply
  • I can see that you have:

        IODIR1 = 0x00FF0000;
        IOSET1 = 0xffff;
    


    Reading the user manual for the processor, I see that a '1' sets a pin as output.
    So you set:
    P1.0..P1.15 as inputs
    P1.16..P1.23 as outputs
    P1.24..P1.31 as inputs.

    Then you decide to set P1.0..P1.15 high - but you just informed the processor that the pins are inputs...

    How many other interesting things do you have in your code?

    Maybe you should spend some time with the user manual for the processor. Check every single line - and add proper comments. Right now, it seems like the comment "/* LPC21xx definitions */" got there by accident.

    Come back when you have scanned every single source code line and it seems to match the processor documentation. But this time, you could decide to skip the bold feature. It really isn't meaningful to make the full post bold...

Children
More questions in this forum