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:
basic port input/output techniques
Turns on one LED on port B which walks from bit 0 to bit 7 in intervals of 0.5
Uses AVR Timer/Counter1 interrupt to generate the 0.5 sec delay.
Uses Timer/Counter Output Compare Mode to flash a LED with 1 Hz.
Read input port using external Interrupt
Dims a LED using Pulse Width Modulation
Accessing variables stored in internal EEPROM
Decodes RC5 remote control codes
Test program for my AVR starter kit
Example using the External Memory Interface available on some AVR.
Demonstrates debouncing eight keys using a timer interrupt.
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
It can be used to communicate with I2C devices (serial EEPROM, serial RTC etc) from
any AVR device.
- LCD library for HD44870 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.
- UART library
This library can be used to transmit and receive data through the built-in UART.
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
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
© Copyright 2006 Peter Fleury http://tinyurl.com/peterfleury