AVR is a family of microcontrollers from Atmel. In principle, microcontroller is a midget computer in a single IC which can be programmed to do all sorts of things. AVRs are equipped with built-in peripherals like digital input-output (I/O) ports, timers, analog-to-digital converters (ADC), serial interfaces,pulse width modulation (PWM) and a lot more. AVRs are easy to handle and fairly inexpensive. This makes AVR microcontrollers a great choice for the hobbyist!



ATmega8

Atmega8 is a low-power Atmel 8-bit AVR RISC-based microcontroller combines 8KB of programmable flash memory, 1KB of SRAM, 512K EEPROM, and a 6 or 8 channel 10-bit A/D converter. The device supports throughput of 16 MIPS at 16 MHz and operates between 2.7-5.5 volts. ATmega8 provides the following features: 8 Kbytes of In-System Programmable Flash with Read-While-Write capabilities, 512 bytes of EEPROM, 1 Kbyte of SRAM, 23 general purpose I/O lines, 32 general purpose working registers, three flexible Timer/Counters with compare modes, internal and external interrupts, a serial programmable USART, a byte oriented Two-wire Serial Interface, a 6-channel ADC with 10-bit accuracy, a programmable Watchdog Timer with Internal Oscillator, an SPI serial port, plus five software selectable power saving modes.

Pin Description Snippets

• VCC → Digital supply voltage

• GND → Ground

• Port B (PB7..PB0) → Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit)

• Port C (PC5..PC0) → Port C is an 7-bit bi-directional I/O port with internal pull-up resistors (selected for each bit)

• Port D (PD7..PD0) → Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit)

• RESET → Reset input. A low level on this pin for longer than the minimum pulse length will generate a reset, even if the clock is not running

• AVCC → AVCC is the supply voltage pin for the A/D Converter, Port C (3..0), and ADC (7..6). It should be externally connected to VCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC through a low-pass filter

• AREF → AREF is the analog reference pin for the A/D Converter.

(for complete details, refer the Atmega8 datasheet : http://www.atmel.in/Images/Atmel-2486-8-bit-AVRmicrocontroller-ATmega8_L_datasheet.pdf)

Introduction to Atmega programming

This part is an introduction to the programming of an Atmega microcontroller, intentionally prepared as a guide for beginners. The explanations provided are neither thorough nor perfect. The drive is only to lower the incumbrance of getting started. Before starting to write your own programs, it is advisable to first familiarize with the fundamentals. To compile your programs and transfer them to the microcontroller, besides a PC, few tools have to be needed.The first thing you should do is the setting up of a simple breadboardcompatible power supply unit. After building this, you can leap into the construction of a small development platform just for the Atmega8 microcontroller.

Breadboard-compatible 5V power supply

This is an ultra simple regulated 5VDC power supply unit, which can be externally powered from any suitable 9 to 12 V battery or power adaptor. With a little skill and patience, you can assemble the circuit to handly fit (with the help of two male pin-headers soldered at both ends of the circuit board) in standard breadboards . A small piece of general-purpose PCB is enough & more for this!

→ Part 2: ATmega Development Board & Program Adaptor