Im having trouble with my usbtiny kit. I just started with AVR's so i think im just doing something wrong
I have connected a LED to PB0 on my atmega 8
I flashed in a program that would turn whole port B high (1), so my led would turn on.
Everything worked fine as expecting
But then i wanted to turn off my LED, so i flashed in a program that would turn portB low (0), but my portB is staying high all of the time
Avrdude says i flashed my chip correctly, but it seems that my atmega8 wont accept the new program and just runs the old one
This is my avrdude 'reply'
Code: Select all
C:\Documents and Settings\Windows>avrdude -c usbtiny -p m8 -U flash:w:kars01.hex
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 "kars01.hex"
avrdude: input file kars01.hex auto detected as Intel Hex
avrdude: writing flash (74 bytes):
Writing | ################################################## | 100% 0.20s
avrdude: 74 bytes of flash written
avrdude: verifying flash memory against kars01.hex:
avrdude: load data flash data from input file kars01.hex:
avrdude: input file kars01.hex auto detected as Intel Hex
avrdude: input file kars01.hex contains 74 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.14s
avrdude: verifying ...
avrdude: 74 bytes of flash verified
avrdude: safemode: Fuses OK
avrdude done. Thank you.
This is my led on and led off code:
Code: Select all
// LED ON
#include <avr/io.h>
int main(void)
{
// Set Port B pins as all outputs
DDRB = 0xff;
// Set all Port B pins as HIGH
PORTB = 0xFF;
return 1;
}
// LED OFF
#include <avr/io.h>
int main(void)
{
// Set Port B pins as all outputs
DDRB = 0xff;
// Set all Port B pins as LOW
PORTB = 0x00;
return 1;
}