I have a problem in firing the inteerupt in ISR.I have posted my source code here for your ref.Iam checking for a flag, in main()- while()loop, which is never enabled in TIMER0 ISR.But when i used polling mode its working fine. So I think I definately missing some things some where. I have used this timer ISR to trigger for every 10seconds.
Environment: Eclipse/GNUARM/LPC2214…
I didnt do any thing related to this ISR in any of the startup file and linker script…Please help me on this.
/******************************
main()
{
InitVIC();
while(1)
{
if(Timer_Flag==1)
{
LEDON;
}
}
}
void InitVIC()
{
VICProtection = 0; // Setup interrupt controller.
VICIntEnClear = 0xffffffbf; // Disable all interrupts but the one used for the ROM monitor
VICDefVectAddr = (unsigned int)&DefDummyInterrupt;
T0TCR = 2; // Disable timer 0. and rese
T0PC = 0; // Prescaler is set to no division.
T0MR0 = 0xE666; //PCLKFREQ/1000; // Count up to this value. Generate 1000 Hz interrupt.
T0MCR = 3; // Reset and interrupt on MR0 (match register 0).
T0CCR = 0; // Capture is disabled.
T0EMR = 0; // No external match output.
T0TCR = 1; // Enable timer 0.
VICIntSelect &= ~(0x10); // IRQ on timer 0 line.
VICVectAddr1 = (unsigned int)TimerInterrupt;
VICVectCntl1 = 0x20 | 0x04; // Enable vector interrupt for timer 0.
VICIntEnable = 0x10; // Enable timer 0 interrupt.
}
// Timer interrupt handler
static void TimerInterrupt()
{
(*timer_function)(); // Call timer callback function.
Timer_Count++;
Timer_Flag=0;
if(Timer_Count>10000)
{Timer_Count=0;Timer_Flag=1;}
T0IR = 0xff; // Clear timer 0 interrupt line.
}
//Dummy interrupt handler, called as default in irqHandler() if no other vectored interrupt is called.
static void DefDummyInterrupt()
{}
**/