I'm using the LPC2138 and gnu tools.
I have timer0 interrupts working and now am trying to get timer1
interrupts working. Below is the code. Timer0 works perfectly, but I
can't get any timer1 interrupts. The initialization of timer1 is
almost identical to timer0. Does anyone know why there are no timer1
interrupts?
thanks,
David
#ifdef DO_TIMER0
void __attribute__((interrupt("IRQ"))) tc0(void);
#endif
#ifdef DO_TIMER1
void __attribute__((interrupt("IRQ"))) tc1(void);
#endif
#ifdef DO_TIMER0
T0TCR = 0; // disable timer 0
T0TCR = 2; // reset timer 0
T0TCR = 0;
T0IR = 0xff; // clear timer 0 interrupt line
T0PR = 0x00000000; // prescale = none
T0MR0 = (unsigned long) (.5 + (.005 / PPERIOD)-1.0); // 5 ms
T0MCR = 3; // Interrupt and Reset on MR0
T0CCR = 0; // capture is disabled
T0EMR = 0; // no external match output
T0TCR = 1; // Timer0 Enable
VICVectAddr0 = (unsigned long)tc0; // set interrupt vector in 0
VICVectCntl0 = 0x20 | 4; // use it for Timer 0 Interrupt
VICIntEnable = 0x00000010; // Enable Timer0 Interrupt
#endif // #ifdef DO_TIMER0
#ifdef DO_TIMER1
T1TCR = 0; // disable timer 1
T1TCR = 2; // reset timer 1
T1TCR = 0;
T1TC = 0; // set counter to 0
T1IR = 0xff; // clear timer 1 interrupt line
T1PR = 0x00000000; // prescale = none
T1MR1 = (unsigned long) (.5 + (.005 / PPERIOD)-1.0); // 5 ms
T1MCR = 3; // Interrupt and Reset on MR0
T1CCR = 0; // capture is disabled
T1EMR = 0; // no external match output
T1TCR = 1; // Timer1 Enable
VICIntSelect &= ~0x00000020; // timer1 selected as IRQ, not FIQ
VICVectAddr1 = (unsigned long)tc1; // set interrupt vector in slot 1
VICVectCntl1 = 0x20 | 5; // use it for Timer 1 Interrupt
VICIntEnable = 0x00000020; // Enable Timer1 Interrupt
#endif // #ifdef DO_TIMER1
#ifdef DO_TIMER0
void __attribute__((interrupt("IRQ"))) tc0(void) {
T0IR = 1; // Clear interrupt flag
VICVectAddr = 0; // Acknowledge Interrupt
}
#endif // #ifdef DO_TIMER0
#ifdef DO_TIMER1
void __attribute__((interrupt("IRQ"))) tc1(void) {
NEVER GETS HERE....
T1IR = 1; // Clear interrupt flag
VICVectAddr = 0; // Acknowledge Interrupt
}
#endifMessage
No timer1 interrupts on LPC2138
2005-03-11 by david_z_lawson
Attachments
- No local attachments were found for this message.