Hallo,
der beigefügte Code soll ein einfacher 1sec-Timer (an einem 8 MHz-Asuro) sein, bei dem jede sec eine LED blinkt, aber er funktioniert noch nicht.
Wer sieht, was falsch am Code ist oder fehlt ??? Vermute, dass der timer nicht läuft ?
Danke für Hilfe, Gruss Vilem
Code:
/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   any later version.                                                    *
 ***************************************************************************/
                        /*Fcpu = 8 MHz, LED-TIMER 1/sec */
#include "asuro.h"
#include <avr/io.h>
int main(void)
{
    Init();
 DDRD |= (1 << 0x02); // PD2 als Ausgang
 StatusLED (OFF);
 Msleep (1000);
    PORTD = (1 << 0x02); // PD2 gesetzt (StatusLED rot)
 DDRC |= (0x04);  // Port PC2(=ADC2) als Ausgang = Blink-LED-Anschluss
 
    TCCR1B |= (1 << CS12); // set up timer at Fcpu/256              
 for (;;)
 {
  if (TCNT1 >= 15624) // 
   {PORTC ^= (1 << 0x02);// Toggle die LED
    TCNT1 = 0; //Counter zurücksetzen, 
   }
    }
return (0);
}