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

Interrupt IRQ LPC2148

Hi all. I use ARM LPC2148 for my project and i use Keil uVision4.


µVision V4.60.0.0

Tool Version Numbers:
Toolchain: MDK-Lite Version: 4.60.0.0
Toolchain Path: C:\Keil\ARM\ARMCC\bin\
C Compiler: Armcc.Exe
Assembler: Armasm.Exe V5.02.0.28

I have a problem with interrupt handler irq. I write the following code in language c:

#include <lpc214x.h>

void tc0(void)__irq;
unsigned i = 0;
void main(void)
{

  PLL0CFG=0x24;  //Multipler and divider setup
  PLL0CON=0x01;  //Enable PLL
  PLL0FEED=0xAA; //Feed sequence
  PLL0FEED=0x55;
  while(!(PLL0STAT & 0x0400)) ; //is locked?
  PLL0CON=0x03;  //Connect PLL after PLL is locked
  PLL0FEED=0xAA; //Feed sequence
  PLL0FEED=0x55;
  VPBDIV=0x01;

        VICIntSelect = 0x00;

        VICVectAddr0 = (unsigned long)tc0;
        VICVectCntl0 = 0x20 | 4;

        VICIntEnable = 0x10;

        T0MCR = 0x03;
        T0MR0 = 0x00003000;
        T0TCR = 0x01;

        while(1)
        {
                //loop
        }
}


void tc0(void)__irq
{
        i = 1;
        T0IR = 0x01;
        VICVectAddr = 0x00;
}


When timer match to MR0, run the interrupt service routine tc0. At the end of interrupt service routine tc0 i don't return from service routine to main program. Where am I doing wrong? Why my program doesn't return from service routine? Help me Please. Thanks.

0