I've set LEDs, built an up/down counter, and played with the gnu toolset. Now I'm trying to move on to interrupts, and I'm having some trouble. I wrote a simple C program (which is included below for reference) which is a timer0-based up counter. The LED setup works (I can set the values manually and they display correctly), but the intterupt vector is never called (or at very least, none of the effects are seen). I'm using the latest GNU toolchain and an STK500, and I've checked the internal OSC setting on the STK500. It seems to be set appropriately. I've changed it up and down, but to know effect.
I am most likely missing some initialization step (like the Gen Int Enable on the PICs maybe?), but the thing that bothers me is that I downloaded sample code to help me debug my problem, and the sample code's interrupt routine is not firing either. The sample code was from a tutorial on using interrupts on the AVR from http://members.shaw.ca/climber/a.... I've looked over the Academy's sample code, but most of it is assembly, and my code looks consistent with Design Note #024.
Any help the community can provide would be appreciated. Thanks.
--- Simple C Code Starts Here ---
// timer0 compare match interrupt handler
PORTD = ~counter;
counter = 0x01;
// Set up LED output
DDRD = 0xff;
PORTD = 0xff;
// Init timer zero
TCCR0 = BV(WGM01) | BV(CS02) | BV(CS00); // CTC Mode, 1024 prescalar
TIMSK = BV(TOIE0); // Turn on overflow interrupt
SFIOR |= BV(PSR10); // Strobe the timer-reset register
// Interrupts are OK now...
asm volatile("nop" ::);
//PORTD = ~counter;
--- Simple C Code Ends Here ---