On January 16, 2008 12:56:39 am Joerg Wunsch wrote:
> As Andrew S wrote:
> > Investigating this further, I found that the following corresponded
> > with the microcontroller running the correct interrupt handler for
> > the interrupt in question:
> >
> > ISR(_VECTOR(8))
> > { .. }
>
> That would be TIMER1_COMPB_vect.  Are you sure you are running the
> correct timer? ;-)  Can you post the entire code?
>

Here is my entire code, I apologize for its quality, i've been fighting with 
it and havn't had a good opportunity to clean it up. I'm reasonably confident 
i'm running the correct timer, given that i'm certainly seeing the waveform 
i'd expect on the OC2 pin.

#include <avr/interrupt.h>
#include <util/delay.h>

ISR(_VECTOR(8))
{
  PORTD ^= 0x40;
}

 void timer_init(void) {
        TCCR2 = 0x1B; //setup timer2
        OCR2 = 99; //set top
        TIMSK = TIMSK | 0x80 ; // generate interrupt on timer2 match
}

/**********************************************************************/
int main(void) {
  PORTD = 0xFF;
  DDRD = 0xE0; //Set pin PD7/(OC2) as output, as well as PD5 and PD6
  TIMSK= 0;

  timer_init();
  sei();

  for(;;)
  {
    _delay_ms(10);
    PORTD ^= 0x20;
  }
  return 0;
}

--
Andrew S.


_______________________________________________
AVR-libc-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev

Reply via email to