Hi there.
I have a problem with timer interrupt on LPC2103. I want to set timer interrupt on Timer1.
Timer1 and VIC are initialized with this code:
void TimerInit(void) { T1PR = 0x0000000E; T1MR0 = 100; T1MCR |=0x00000003; //Interrupt and Reset on match with MR0 T1TCR = 0x00000002; //Reset counter and prescaler T1CTCR &=0xfffffffc; //Timer mode T1TCR = 0x00000001; //Enable timer } void VICInit(void) { VICIntEnable = (1 << 5); // Enables interrupt for TIMER1 VICIntSelect = 0; // All interrupts get classified as IRQ. VICDefVectAddr = 0; VICVectAddr0 = (unsigned)scheduler; // Handler for IRQ VICVectCntl0 = 0x25; // Mapping VIC channel VICVectAddr = 0; // Clears the address register }
IRQ is set like this:
B ISR /* IRQ INTERRUPT */
ISR is defined like that:
void ISR(void) //to scheduler { //(*((voidfuncptr)VICVectAddr))(); static int x = 0; if (x == 1) IOCLR=1<<5; else IOSET=1<<5; x=1-x; }
It should point to scheduler, but for test, I just wanted to see if ISR occurs.
I think that there is somethink wrong with VICInit. So, why do you thing this code doesn't work?