/* Interrupt alle 250us, 1 MHz Systemtakt, 8Bit-Timer 0, Overflow-Interrupt, Wechsel an PB0
Taktzahl:   Phi*Sollzeit = 1Mhz*250us = 250
Vorteiler:  Taktzahl/Werteanzahl = 250/256 = 0,98 aus {1,8,64,256,1024} => 1
Vorsteller: Werteanzahl - Taktzahl/Vorteiler = 256 - 250/1 => 6
Probe:      (Werteanzahl-Vorsteller)*Vorteiler/Phi =(256-6)*1/1MHz = 250us
*/
#include <avr/io.h>
#include <avr/interrupt.h>

int main(){          // Hauptprogramm
  PORTB = 0xff;
  DDRB = 0xff;
  TCCR0B = 1;        // Vorteiler 1: /1; 2: /8; 3: /64; 4: /256; 5: /1024
  TIMSK |= 1<<TOIE0; // TimerOverflowInterruptEnable0
  sei();             // globale Interruptfreigabe
  while(1);          // Endlosschleife
  return 0;
}

ISR(TIMER0_OVF_vect){ // Interrupt Service Routine
  TCNT0 = 6;          // wieder vorstellen
  PORTB ^= 1;           // Ausgang PB0 invertieren (PINB = 1)
}
// gemessen 268us woher stammt die Abweichung?