Męczę się już od paru dni nad tą atmegą16. Podłączam ją w ten sposób:
Pin 9 (RESET) => 10kOhm => VCC programatora
Pin 9 (RESET) => 100 nF => GND programatora (przycisk)
Pin 10 (VCC) => 100 nF => VCC programatora
Pin 11 (GND) => 100 nF => GND programatora
Pin 30 (AVCC) => VCC programatora
Pin 31 (GND) => 100nF => GND programatora
(Podobnie jak na obrazku powyżej.)
Pin 32 (AREF) => 100nF => GND programatora
Potem podpinam programator (USBasp):
Pin 6 (MOSI) => MOSI programatora
Pin 7 (MISO) => MISO programatora
Pin 8 (SCK) => SCK programatora
Pin 9 (RESET) => RST programatora
VCC programatora podłączyłem do VCC układu, to samo z GND.
Potem dołożyłem diodę (sprawdzałem osobno - działa):
PA0 (krótsza nóżka diody) => 1kOhm => VCC układu.
Piszę program w C:
Kod: Zaznacz cały
#define F_CPU 1000000L
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
DDRA = 0xFF;
while(1)
{
PORTA = 0x00;
}
}Kod: Zaznacz cały
> "make.exe" program
avrdude -p atmega16 -P usb -c USBasp -U flash:w:led.hex
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x1e9403
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 (140 bytes):
Writing | ################################################## | 100% 1.03s
avrdude: 140 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 140 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.82s
avrdude: verifying ...
avrdude: 140 bytes of flash verified
avrdude done. Thank you.
> Process Exit Code: 0
> Time Taken: 00:03
Programator działa, ponieważ wcześniej programowałem nim atmegę8 i działała.
Z góry dziękuję za odpowiedzi
Patyk12343