Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: IAR interrupt problem

2004-09-21 by Leighton Rowe

I'm curious about 2 things.

1. "__enable_intrinsic()"
   Is this really the function you used or do you really mean 
__enable_interrupt().

2. Where is your IRQ Handler? The only time I used "_irq" was to 
define the IRQ handler...not the ISR.

something like...

__arm __irq void IRQ_handler(void)
{
 ISRAddress = VICVectAddr;     //load source address
 (*ISRAddress)()               //function call
 VICVectAddr=0; //reset VIC
 return;
}

void Timer1ISR(void) //Timer1 ISR
{
   .....
}


That way ISRs get called by the handler whenever any enabled 
interrupt channel is activated. 

Some example code should come with your IAR compiler...somewhere in 
the /ARM/src directory. Make sure u look at those. They'll come in 
very handy.

Leighton

--- In lpc2000@yahoogroups.com, "ducatman2000" <545545@b...> wrote:
> Hi,
> 
> I'm trying to enable interrupt with timer1 on the LPC2106. I 
> configured Timer1 as IRQ source when its value correspond with the 
> match register 0... but interrupt routine service doesn't run and 
is 
> never reached. Here is a piece of my code:
> 
>   __disable_interrupt(); // IAR intrinsic
> //VIC enable registers
>   VICProtection=0x0;    
> 
> //clears bits in the Interrupt Enable register  
>   VICIntEnClear=0xffffffff;   
> 
>   VICIntEnable=0x20;    //Timer1
>   VICIntSelect=0x00;    //all interrupts are IRQs
>   VICVectCntl0=0x25;    
>   VICVectAddr0=(unsigned long)&Timer1ISR;
> 
>   __enable_intrinsic();
> 
>   Then I also initialize Timer1:
> 
>   T1_IR=0x00;
>   T1_MR0=TIMERMATCH;
>   T1_MCR=0x03;  // reset timer and fire interrupt        
>   T1_PR=0x0;         
>   T1_TC=0x00;   
>   T1_TCR=0x01;  // start the timer
> 
> __arm __irq void Timer1ISR(void) //Timer1 ISR
> {
> T1_IR=0x01; //reset interrupt flag
> VICVectAddr=0; //reset VIC
> return;
> }
> 
> My questions are:
> 
> - what is wrong with this code?
> - could it be a problem with the intrinsic functions of IAR    
> __enable_interrupt() and __disable_interrupt(); they seem not to 
> work; does anybody their asm code??
> 
> Any help would be appreciated!
> 
> thanx

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.