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

int main(){          // Hauptprogramm
  PORTB = 0xff;
  DDRB = 0xff;
  TCCR0B = 5;        // Systemtakt durch 1024
  TIMSK |= 1<<TOIE0; // TimerOverflowInterruptEnable0
  sei();             // globale Interruptfreigabe
  while(1);          // Endlosschleife
  return 0;
}

ISR(TIMER0_OVF_vect){ // Interrupt Service Routine
  static unsigned char teiler=0;
  TCNT0 = 12;         // wieder vorstellen
  teiler++;
  if(teiler>=2){      // Teilfaktor in ISR
    teiler=0;
    PORTB ^= 1;           // Ausgang PB0 invertieren (PINB = 1)
  }
}