IAR interrupt problem
2004-09-21 by ducatman2000
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