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

ISR is not executing in lpc2138

This is the code i used,

void extint(void) __irq ;

void main()
{
        PINSEL0 = 0X0000000C;                       //selecting EXT0
        IODIR0 = 0x0000ff00;
        VICVectCntl0 = 0x0000002E;

        VICVectAddr0 = (unsigned long)extint;
        VICIntEnable = 0x00004000;



        IODIR0 = 0x00ff0000;
        while(1)
        {
                IOSET0 = 0x00ff0000;
                IOCLR0 = 0x00ff0000;
        }

}

void extint(void) __irq
{
        IOSET0 = 0x0000ff00;
        EXTINT = 0x00000001;
        VICVectAddr = 0;
}

it compiles. but when I run it on the simulation it does not enters in to the ISR function.

when I checked it on debug mode, the 'int' bit in EINTO is getting set and the VICVectAddr

also updated with the address of VICVectAddr0.

I used an example and it worked fine.

In the disassembly, in the address 0x00000018"LDR PC, [PC, #-0x0FF0]"

Parents Reply Children
  • In the Example code, the disassembler start address 0x00000000 contains the label 'Vectors'

    "Vectors LDR PC, Reset_Addr"

    which is the reset address.

    In the project which I created the start address 0x00000000 contains the label, '__main'

    why the this is not starts from the label, 'Vectors'.

    what I am asking is , should I have to change any configuration to get it load from the Vectors.

    if it loads from the label 'Vector', I think the ISR function will get executed.

    Thank you for the reply.

  • Do you have a startup file in your project?

    A normal project would link with the startup file starting from address zero, getting the reset vector first in memory. Only when doing advanced programming (like running on a system that has a boot loader) could it be relevant with a different address for the vector table.

  • It has the startUp file included while the project creating.

    and I just tried the code in simulation.

    I thought I missed some basic thing, which is faced by some people.

    Thankyou,

  • My problem got solved.

    if someone have the same problem follow this.

    Project -> option for target -> Linker -> select the checkbox "Use Memory Layout From Target Dialog"