Skocz do zawartości

Problem z przesłaniem programu do uC


Pomocna odpowiedź

1. Błędów i warningów kompilacji oczywiście nie masz?

2. sprawdź czy diodę masz we właściwym kierunku (masz multimetr)?

Program powinien działać nawet w takiej wersji:

#define F_CPU 1000000L 
#include <avr/io.h> 
#include <util/delay.h> 

int main(void) 

{ 

 DDRD = 0xFF; 

 while(1); 
 { 
   PORTD ^= (1<<PD7); //zmień stan LED na przeciwny
   _delay_ms(330); 
 } 
}

Tutaj raport z kompilacji:

> "make.exe" all

-------- begin --------
avr-gcc (WinAVR 20100110) 4.3.3
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Size before:
AVR Memory Usage
----------------
Device: atmega8

Program:      66 bytes (0.8% Full)
(.text + .data + .bootloader)

Data:          0 bytes (0.0% Full)
(.data + .bss + .noinit)




Size after:
AVR Memory Usage
----------------
Device: atmega8

Program:      66 bytes (0.8% Full)
(.text + .data + .bootloader)

Data:          0 bytes (0.0% Full)
(.data + .bss + .noinit)



-------- end --------


> Process Exit Code: 0
> Time Taken: 00:03

A tutaj z przesyłania programu:

> "make.exe" program
avrdude -p atmega8 -P usb -c usbasp    -E noreset  -U flash:w:led.hex 
avrdude: WARNING: -E option not supported by this programmer type

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9307
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
        To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "led.hex"
avrdude: input file led.hex auto detected as Intel Hex
avrdude: writing flash (66 bytes):

Writing | ################################################## | 100% 0.33s

avrdude: 66 bytes of flash written
avrdude: verifying flash memory against led.hex:
avrdude: load data flash data from input file led.hex:
avrdude: input file led.hex auto detected as Intel Hex
avrdude: input file led.hex contains 66 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.30s

avrdude: verifying ...
avrdude: 66 bytes of flash verified

avrdude done.  Thank you.


> Process Exit Code: 0
> Time Taken: 00:03

Jeśli chodzi o multimetr tak mam, ale dioda myślę że jest odpowiednio spolaryzowana, anoda do PD7, katoda do GND. Niestety zwątpiłem że to zadziała 😋

Witam ponownie, dioda już działa, problem był w tym że nie działa mi funkcja while... nie wiem dlaczego, zmieniłem na "for" i elegancko miga:) żeby nie zaczynać nowego tematu, co może być przyczyną tego że pętla while nie działa?

Bądź aktywny - zaloguj się lub utwórz konto!

Tylko zarejestrowani użytkownicy mogą komentować zawartość tej strony

Utwórz konto w ~20 sekund!

Zarejestruj nowe konto, to proste!

Zarejestruj się »

Zaloguj się

Posiadasz własne konto? Użyj go!

Zaloguj się »
×
×
  • Utwórz nowe...