Programmers

All on one SLOW page
Serial Port
Parallel Port
Smart Programmers
Serial Loaders

Projects

ATmega8 Serial LCD
ATtiny2313 Serial LCD
ATtiny4313 Serial LCD
ATmega328 SIRC
ATtiny2313 SIRC
40-pin Dev Board
28-pin Dev Board
AVR PS/2 Keyboard
AVR MAX232 RTS/CTS
AVR Dual RS232 Ports

Minimal Circuits

ATmega16
ATmega32
ATmega644
ATmega1284
ATmega8515
ATmega8535
ATmega8
ATmega48
ATmega88
ATmega168
ATmega328
ATmega162
ATmega128
ATtiny13
ATtiny2313
ATtiny4313
ATtiny24
ATtiny84
ATtiny25
ATtiny45
ATtiny85

Other Stuff

ATtiny13 vs ATtiny85
ATmega8 vs ATmega88
ATmega16 vs ATmega164
ISP and SPI
MAX232 Arduino
A small FAQ
Hardware Info

AVR Test Application

C Source Code

The program is pretty simple. It blinks an LED attached to PB0.

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

int main( void )
{
        DDRB |= 1;              // Change to 16 for ATtiny13
        while( 1 )
        {
                PORTB &= ~1;    // Change to 16 for ATtiny13
                _delay_ms( 200 );
                _delay_ms( 200 );
                _delay_ms( 200 );
                _delay_ms( 200 );
                PORTB |= 1;     // Change to 16 for ATtiny13
                _delay_ms( 200 );
                _delay_ms( 200 );
                _delay_ms( 200 );
                _delay_ms( 200 );
        }
        return 0;
}

Makefile

The Makefile is also simple. This one is for Linux. Change the "-mmcu=atmega32" to whatever microcontroller you are using. Also change the "-p m32" on the avrdude command tail to match your microcontroller.

CC=/usr/bin/avr-gcc
CFLAGS=-g -Os -Wall -mcall-prologues -mmcu=atmega32
OBJ2HEX=/usr/bin/avr-objcopy
LOADER=/usr/bin/avrdude -c arduino -P /dev/ttyUSB0 -p m32 -b 19200 -U flash:w:
TARGET=blink

all : $(TARGET).hex
        $(LOADER)$(TARGET).hex

%.obj : %.o
        $(CC) $(CFLAGS) $< -o $@

%.hex : %.obj
        $(OBJ2HEX) -R .eeprom -O ihex $< $@

clean :
        rm -f *.hex *.obj *.o

The makefile is a little different for WinAVR. This makefile is courtesy of Ken.

CC=avr-gcc
CFLAGS=-g -Os -Wall -mcall-prologues -mmcu=attiny13
OBJ2HEX=avr-objcopy
LOADER=avrdude -c usbtiny -P USB -p t13 -b 19200 -U flash:w:
TARGET=Blinky

all:    $(TARGET).hex
                $(LOADER)$(TARGET).hex

$(TARGET).o:    $(TARGET).c
                        $(CC) $(CFLAGS) $< -o $@

$(TARGET).hex:  $(TARGET).o
                        $(OBJ2HEX) -R .eeprom -O ihex $< $@

clean:
                rm -f *.hex *.obj *.o