hallo ich lese mir gerade das timer tutorial auf avrfreaks durch (http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=50106) und hab nur eine kurze frage zu folgendem Code: Dient das leere for(;;) einfach nur dazu das der Controller irgendwas macht oder welchen sinn hat es??? #include <avr/io.h> #include <avr/interrupt.h> int main (void) { DDRB |= (1 << 0); // Set LED as output TCCR1B |= (1 << WGM12); // Configure timer 1 for CTC mode TIMSK |= (1 << OCIE1A); // Enable CTC interrupt sei(); // Enable global interrupts OCR1A = 15624; // Set CTC compare value to 1Hz at 1MHz AVR clock, with a prescaler of 64 TCCR1B |= ((1 << CS10) | (1 << CS11)); // Start timer at Fcpu/64 for (;;) { } } ISR(TIMER1_COMPA_vect) { PORTB ^= (1 << 0); // Toggle the LED }
marvin schrieb: > Dient das leere for(;;) > einfach nur dazu das der Controller irgendwas macht korrekt. I.d.R. endet ein uC-Programm nicht.
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.