Hallo leute
ich habe eine Frage bezüglich Timer interrupt
ich habe das folgende Code für ein Tiny85 geschrieben und ein Interrupt 
overflow bei jede 50ms zu bekommen
1  | #define TCCR0Binit   0b00000100    //prescaler auf 256
  | 
2  | #define TCNT0init  0b00111011    //Startwert Counter 59 
  | 
3  | #define TIMSKinit  0b00000010    //Timer/Counter Overflow Interrupt ein
  | 
4  | #define DDRBinit   0b00000111    
  | 
5  | #define PORTBinit   0b00000000    
  | 
6  | 
  | 
7  | volatile int i =0; 
  | 
8  | 
  | 
9  | ISR( TIMER0_OVF_vect ){
 | 
10  |   
  | 
11  |   TCNT0  = TCNT0init;
  | 
12  |    TCCR0B  = TCCR0Binit;    // prescaler auf 1024
  | 
13  |     TIMSK   = TIMSKinit;    //TOV interrupt aktiviert
  | 
14  |   sei();
  | 
15  |   i++;
  | 
16  | 
  | 
17  |   
  | 
18  | }
  | 
19  |  
  | 
20  | int main() {
 | 
21  |  
  | 
22  |     DDRB = DDRBinit;
  | 
23  |     PORTB = PORTBinit;
  | 
24  | 
  | 
25  |   TCNT0  = TCNT0init;
  | 
26  |    TCCR0B  = TCCR0Binit;    // prescaler auf 1024
  | 
27  |     TIMSK   = TIMSKinit;    //TOV interrupt aktiviert
  | 
28  |   sei();
  | 
29  |  
  | 
30  | 
  | 
31  |  while(1)
  | 
32  |  {
 | 
33  |    if(i%2 ==1){
 | 
34  |   
  | 
35  |   PORTB |= (1 << PB0);
  | 
36  |   }
  | 
37  |   else{ 
 | 
38  |   PORTB &= ~(1<<PB0);
  | 
39  |   }
  | 
40  |   
  | 
41  |   
  | 
42  |   }
  | 
43  | }
  | 
bei ozsiloskop bekommt man tatsächlich ein Interrupt aber jede 51,2ms 
obwohl es tehoretig nach dieser Regel nicht geht -->  Counter soll 
gleich =(255-(F_CPU/Prescaler*0,05s+0,5))
da ich mit einer Frequenz von 8 mhz ein prescaler 256
könnte das an den fuses liegen (siehe Bild ) weil ich mit nem internen 
Quarzoszillator arbeite.