Vectored IRQ does not go to ISR in LPC2148.

OP (Company: slim gym enterprises) #1918339
Rate this post
• ▲ useful
▼ not useful
Hi,

I am using GNU ARM C compiler from Raisonace(RIDE).

I have written code for LPC2148  that generate interrupt when Timer-1 
match the register T1MR0.

ISR simply turn on LED on Port 1.

Problem is that Code come out of main loop but does not go to ISR.

I search a lot in the examples code and have used a lot but nothing 
likes to work.

Do I need to make changes in Start-up code.

I have attached Startup code file.

#include<lpc21xx.h>

#define LED1  0x00000001;
#define LED2  0x00000002;

void delay(void);

void  TIMER1_IRQ(void)  _attribute_ ((interrupt("IRQ")));;

int main (void)
{

IO0DIR =0XFFFFFFFF;
IO0SET = LED2;

/*********************************** TIMER-0 SETUP 
FORDELAY********************************/

VPBDIV = 0x02;                                  //DIVIDED CCLOCK BY TWO
T0CTCR = 0X00;                                  //SET COUNTER AS TIMER
T0MCR  = 0X06;                                  //TC REST ON MATCH
T0IR   = 0X00;                                  //CLEAR ALL INTERRUPT
T0PR   = 0X06;                                  //COUNTER CLOCK DIVIDED 
BY 6=1MHz

/*********************************** TIMER-1 SETUP INTERRUPT AFTER 
1SEC*******************************/
T1TCR  = 0X02;                                  //MAKE TC REST
T1CTCR = 0X00;                                  //SET COUNTER AS TIMER
T1MCR  = 0X03;                                  //INTERRUPT AND REST ON 
MATCH
T1IR   = 0X00;                                  //CLEAR ALL INTERRUPT
T1PR   = 0X06;                                  //COUNTER CLOCK DIVIDED 
BY 6=1MHz
T1MR0  = 1000000;                               //MATCH-0=1000

VICIntSelect = 0x00000000;                      //SET THE TIMER-1 
MATCH-0 INTERRUPT AS IRQ
VICVectCntl0 = 0x00000025;                      //SET CHANNEL
VICVectAddr0 =(unsigned long)TIMER1_IRQ;        //LOCAD THE ADDRESS OF 
ISR
VICIntEnable = 0x00000020;                      //ENABLE TIMER1 
INTERRUPT

T1TCR =0X01;                                  //ENABLE TIMER-1

for(;;)
{
IO0SET = LED1;
delay();
IO0CLR = LED1;
delay();
}
}
/**************************************** End 
Main**************************************************/

void delay(void)
{
T0MR0 = 250000;                                    //MATCH-0=250000
T0TCR = 0X01;                                      //TURN ON TIMER-0
while((T0TCR & 0X01)==0X01);                       //WAIT FOR TIMER 
MATCH AND INTERRUPT FLAG SET
T0TCR = 0X00;                                      //TURN OFF AND RESET 
TIMER-0
}

/********************************** INTERRUPT 
SUBROUTINE**************************************/
void TIMER1_IRQ(void)
{
IO0CLR = LED2;
T1IR  |=0X00000001;                                 //CLEAR MATCH-0 
INTERRUPT
VICVectAddr =0X00000000;
T1TCR  = 0X01;                                      //TURN ON TIMER-0
   }
Attached files:

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.