Vielleicht hilft das folgende weiter
/*
Test program for Timer/Counter 0 in the Interrupt Mode
Every time the Timer starts an interrupt routine the led variable
is written on the PORTB and increased one time.
Leitner Harald
07/00
*/
#include <io.h>
#include <interrupt.h>
#include <sig-avr.h>
uint8_t led= 0;
uint8_t ton= 0x00;
uint8_t dur= 0x00;
uint8_t nnn= 0x00;
SIGNAL (SIG_OVERFLOW0)
{
outp(~led, PORTB); if (led++ >=2) led = 0;
outp(ton,TCNT0); /* reload timer with initial value */
if( dur++ == 100 )
{
if( ton++ > 0xf0 ) ton= 0x00;
dur= 0;
/*
if( ++nnn > 0x10 ) outp( ~(1<<TOIE0), TIMSK);
*/
}
}
int main( void )
{
outp(0xFF, DDRB); /* use all pins on PORTB for output */
outp((1<<TOIE0), TIMSK); /* enables the T/C0 overflow interrupt
*/
outp( ton, TCNT0); /* start value of T/C0 */
outp( 2, TCCR0); /* prescale ck / [1,2,3,4,5] */
sei(); /* set global interrupt enable */
for (;;){}
}