I'm new to embedded and I've been struggling with this for days. I just don't understand why this doesn't work.
I'm using an ATxMega128A1. I want to use a timer overflow interrupt to left shift a bit on a port to the next pin. The timer works. I can see it click through CNT in the simulator, and the overflow flag gets set, but the ISR never executes (and thus, the overflow flag never gets reset either). Does anyone have any idea where I'm going wrong? I more or less copy/pasted the timer/interrupt code from Atmel's training code.
ISR(TCC0_OVF_vect)
{
LEDPORT = (LEDPORT << 1);
}
int main(void)
{
initLights();
// Set up Timer/Counter 0.
TCC0.PER = 0x10; //
TCC0.CTRLA = ( TCC0.CTRLA & ~TC0_CLKSEL_gm ) | TC_CLKSEL_DIV1_gc; //start timer with system clock
TCC0.INTCTRLA = ( TCC0.INTCTRLA & ~TC0_OVFINTLVL_gm ) | TC_OVFINTLVL_LO_gc; // Enable overflow interrupt.
// enable global interrupts:
sei();
while(true)
{
//do nothing, the timer interrupt will handle it
}
}