Gast
#538911
Habe ein Problem mit Timer 0 aber erst seit heute. Kein Code geändert nur den AVR mal eingeschaltet und er bleibt nach T4 hängen. In der While schleife. void init_timer0() { int temp0,temp1; for(temp0=0;temp0<0x0040;temp0++) // Wait for external clock crystal to stabilize { for(temp1=0;temp1<0xFFFF;temp1++); } // DDRB=0xFF; send_UART("T1\r\n"); TIMSK &=~((1<<TOIE0)|(1<<OCIE0)); //Disable TC0 interrupt send_UART("T2\r\n"); ASSR |= (1<<AS0); //set Timer/Counter0 to be asynchronous from the CPU clock send_UART("T3\r\n"); //with a second external clock(32,768kHz)driving it. TCNT0 = 0x00; TCCR0 = 0x05; //prescale the timer to be clock source / 128 to make it send_UART("T4\r\n"); //exactly 1 second for every overflow to occur while(ASSR&0x07); //Wait until TC0 is updated TIMSK |= (1<<TOIE0); //set 8-bit Timer/Counter0 Overflow Interrupt Enable send_UART("T5\r\n"); } Deswieteren habe ich ein Problem wenn ich den AVR einschalte zeigt er manchmal müll auf dem display und wenn ich ihn nochmals aus/einschalte ist es Ok. aber das Problem mit dem TImer habe ich erst seit heute. Hat jemand eine Idee??? AVR kaputt????