//----------------------------------------------------------------------------- // Sprache : C // Version : 1.0 // Autor : Christian Müller - www.myAVR.de // Prozessor : ATmega2560 // Takt : 16 MHz // Programmer : mySmartUSB MK3 //----------------------------------------------------------------------------- // Titel : LED-Bar // Sample W01 - myAVR Beispiel für das MK3 Board // (mehr und ausfühlicher im SiSy-Projekt im Download unter www.myAVR.de) // title : LED-Bar // Sample W01 - myAVR sample for the MK3 board // (more details in the SiSy-project at download on www.myAVR.de) //----------------------------------------------------------------------------- // Funktion : Zählt eine Wert hoch und gibt ihn an der LED-Bar aus // function : count a value up and output it on the LED-bar // Schaltung : Quick-Connect "LED on Port-L" auf dem MK3 Board // circuit : Quick-Connect "LED on Port-L" at the MK3 board //----------------------------------------------------------------------------- #define F_CPU 16000000 #include //----------------------------------------------------------------------------- //de: Hauptfunktion //eng: mainfunction int main (void) { // Init //de: Port-L als Ausgang konfigurieren (für die LEDs) //eng: config port-L as output (for the LEDs) DDRL=0xFF; //de: zu zählender Wert, mit Null vorbelegen //eng: the counted value, init with zero uint8_t wert=0; // Mainloop while (true) { //de: den aktuellen Wert an den LEDs ausgeben //eng: output the actual value on the LEDs PORTL=wert; //de: den Wert um eins hochzählen //eng: increase the value by one wert++; //de: 200ms warten = Makro aus der myAVR.h (Include über io.h) //eng: wait 200ms = macro in the myAVR.h (included by io.h) waitMs(200); } return 0; } //-----------------------------------------------------------------------------