avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] lack of interruption


From: E. Weddington
Subject: Re: [avr-gcc-list] lack of interruption
Date: Mon, 22 Nov 2004 15:12:23 -0700
User-agent: Mozilla Thunderbird 0.7.3 (Windows/20040803)

jeffrey traer bernstein wrote:

can't quite figure out why my interrupt isn't interrupting... anybody
have any suggestions?

it's on an atmega16



#include <avr/io.h>
#include <avr/interrupt.h>

void SIGNAL( SIG_OVERFLOW0 )
{
   PORTA = 0x00;
}


int main()
{
 DDRA = 0xff;
PORTA = 0x01;
 TIMSK = _BV(TOIE0);
 TCCR0 = 0x05;
 TCNT0 = 0;

 sei();

 while ( 1 );

 return 0;
}

According to the datasheet:

"In normal operation the Timer/Counter Overflow Flag
(TOV0) will be set in the same timer clock cycle as the TCNT0 becomes zero."

I'm not sure if this will help but, but try changing it:

 TIMSK = _BV(TOIE0);   // Enable interrupt.
 TCNT0 = 0;            // Clear timer.
 TCCR0 = 0x05;         // Start timer with div 1024 prescaler.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]