Hallo,
Ja, das progamm soll ersteinmal nur blinken, da ich sonst noch nichts mit dem GCC hingekiegt habe. Hier ist das Programm, es zweigt immer die LEDs 0 und 2 an und led1 aus. (Das habe ich mit allen optimierungs optionen ausprobiert(auch wenn ich mit schon gedacht habe das es mit -O3 nicht besser klappt als mit -O2))
Gruß steinCode:#define __AVR_ATmega8__ #define F_CPU 4000000UL // 4MHz #include <avr/io.h> #include <compat/deprecated.h> #include <inttypes.h> #include <util/delay.h> unsigned char c,d,e; main(){ char in; outp(DDRB , 0x07); /* PortB als Ausgang 0000 0111*/ outp(DDRD, 0xF3); /* eingang 1111 0011*/ outp(PORTD, 0x0c); /* pull-up ein 0000 1100*/ sbi(PORTB,1); while(1) { /* on */ cbi (PORTB,0); /* wait a short time */ for(c=0;c<=100;c++) _delay_ms(2.2); sbi (PORTB,1); /* wait a short time */ for(c=0;c<=100;c++) _delay_ms(2.2); } }







Zitieren

Lesezeichen