I am trying to test the timer for LPC3250.I am not sure what is issue with the below code.Interrupt is getting enabled but it is getting in one after another interrupt because of which it is just stuck in ISR.I tired using the CDL and it also gives the same error. Please let me know if i am missing any setting. /* Timer example */ void time_task() { /*Init timer */ // int x =0; //term_dat_out(sendstr, sizeof(sendstr));
TIMCLK_CTRL1 |= 0x04;
T0TCR =0;
T0CTCR =00;
T0MCR =0; T0CCR =0; T0EMR=00; T0TC=0; T0PC=0; T0PR=0; T0MR0 = 0; T0MR1 = 0; T0MR2 = 0; T0MR3 = 0; T0IR |= 0x01;
/* Set up timer scale*/
//T0PR = timer_usec_to_val(CLKPWR_TIMER0_CLK, 100);
T0PR = 0x514; /* match count value of 1000*/ T0MR0=999; T0MCR |= 0x03;/* Interrupt, Reset and NO stop */ T0IR |= 0x01; /* clear the interrupt bit*/
/* Enable timers (starts counting) */ msecs = 0;
T0TCR |= 0x01; /* enable Timer*/
ctl_set_isr(Timer0_INT, 3, CTL_ISR_TRIGGER_HIGH_LEVEL, timer0_user_interrupt, 0); ctl_unmask_isr(Timer0_INT);
}
static void timer0_user_interrupt() { /* Clear latched timer interrupt */ //timer_ioctl(timer0dev, TMR_CLEAR_INTS, TIMER_CNTR_MTCH_BIT(0));
/* Turn on LED1 */ //ctl_board_set_leds(1); T0IR |= 0x01; /* clear the interrupt bit*/ msecs += 100;