EmbDev.net

Forum: ARM programming with GCC/GNU tools Vectored IRQ does not go to ISR in LPC2148.


Author: Amogh Prabhulkar (Company: slim gym enterprises) (amogh)
Posted on:
Attached files:

Rate this post
0 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
   }

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.