The following example programs, which I have developed, are written in C for use with
the AVR-GCC compiler.
Tested with AVR-GCC (WinAVR
20060125 or newer)
using a AT90S8515-8PC at 4 Mhz and ATmega8 with 1Mhz..
For easy downloading, all these examples are available in a single archive:
avrgcc-examples.zip
- helloled
basic port input/output techniques
- walkingled
Turns on one LED on port B which walks from bit 0 to bit 7 in intervals of 0.5
sec
Uses AVR Timer/Counter1 interrupt to generate the 0.5 sec delay.
- flashled
Uses Timer/Counter Output Compare Mode to flash a LED with 1 Hz.
- externint
Read input port using external Interrupt
- pwmdemo
Dims a LED using Pulse Width Modulation
- test_eeprom
Accessing variables stored in internal EEPROM
- RC5decode
Decodes RC5 remote control codes
- test_starterkit
Test program for my AVR starter kit
- externalsram
Example using the External Memory Interface available on some AVR.
- debounce_keys
Demonstrates debouncing eight keys using a timer interrupt.
- adc
Analog to digital conversion using the built-in ADC of the ATmega8
I have developed the following libraries which can be used with the AVR-GCC compiler:
Tested with AVR-GCC (WinAVR 20060125 or newer) using a AT90S8515-8PC at 4
Mhz and ATmega8 at 1Mhz and 4 Mhz.
All libraries are open source under the GNU GPL license.
- I2C Master Interface
This library consists of a C include file i2cmaster.h and an assembler
module i2cmaster.S.
It can be used to communicate with I2C devices (serial EEPROM, serial RTC etc) from
any AVR device.
i2cmaster.zip
Online Manual
- LCD library for HD44780 based LCD's
This library can be used to access a HD44780-based character LCD module. The
library can be operated in both the memory-mapped mode and in the 4-bit I/O port mode,
depending on the value of LCD_IO_MODE in lcd.h.
lcdlibrary.zip
Online Manual
- UART library
This library can be used to transmit and receive data through the built-in UART.
uartlibrary.zip
Online Manual
AVR Studio compatible Boot Loader
This boot loader support the STK500v2 protocol as used by AVR Studio 4.x and
allows application firmware to be upgraded at the target microcontroller via a
serial link without the use of a ISP programmer. Fits into a 512work boot loader
section.
stk500v2bootloader.zip
Test program for my AVR Starter Kit
For testing my AVR starter kit, I have developed the
following test program, which is already compiled/linked for direct downloading with a
programmer. (test_starterkit.zip).
© Copyright 2006 Peter Fleury http://tinyurl.com/peterfleury