Erster Versuch: Blink-LED
(EN google-translate)
(PL google-translate)
Warranty disclaimer: The following hard- and software solutions are supplied "as is" without warranty of any kind.
Bild 0-1: LED ergänzt: Kathode über 100Ω-Widerstand (braun-schwarz-braun) gegen Masse (GND) und mit der Anode an Pin 20 des ATmega32 angeschlossen (PD6).
|
|
cd /mnt-system avr-gcc -O2 -mmcu=atmega32 test.c -o test.elf avr-objcopy -O ihex -j .text -j .data test.elf test.hex avrdude -c ponyser -p m32 -P /dev/ttyS0 -U flash:w:./test.hex:a oder avrdude -c ponyser -p m32 -P /dev/ttyUSB0 -U flash:w:./test.hex:a
Code 0-1: Befehlsliste für Test.
#include<avr/io.h> int main() { long pause; DDRD |= 0b01000000; while(1) { PORTD |= 0b01000000; for(pause=0;pause<50000;pause++) DDRD |= 0b01000000; //Dummy-Befehl PORTD &= 0b10111111; for(pause=0;pause<50000;pause++) DDRD |= 0b01000000; //Dummy-Befehl } }
Code 0-2: Quelltext test.c für eine blinkende LED bei PD6.