Gast
#1353781
Hi Ich versuche gerade einen Atmega zu programmieren. Um zu testen, ob der ganze Aufbau samt Programmer funktioniert, habe ich eine LED an PB0 angeschlossen und folgendes Programm gebrannt. Leider funktioniert es nicht (Led bleibt dunkel), deshalb mal die Frage, ob mit dem Programm an sich alles in Ordnung ist... #include <avr/io.h> #define LED PB0 #define output_low(port,pin) port &= ~(1<<pin) #define output_high(port,pin) port |= (1<<pin) #define set_input(portdir,pin) portdir &= ~(1<<pin) #define set_output(portdir,pin) portdir |= (1<<pin) void delay_ms(uint8_t ms) { uint16_t delay_count = 16000000 / 17500; volatile uint16_t i; while (ms != 0) { for (i=0; i != delay_count; i++); ms--; } } int main(void) { set_output(DDRB, LED); while (1) { output_high(PORTB, LED); delay_ms(200); output_low(PORTB, LED); delay_ms(200); } }