Friday, April 24, 2009

ATmega32 Tutorial in C - Part I

Recently I have worked with ATmega32. I am using avr-gcc library(C program) to program ATmega32. When I first start to work I can't find good source or link to learn. So I have taken decision to write something about it.

First off all you need some softwares and hardwares to start.

1. C compiler(AVRGCC)
2. AVR Studio
3. Proteus --- For circuit simulation

Proteus is not necessary. But if you want to check your design before making the hardware you can use this tool to simulate your circuit before burning.

4. ATmega32/ATmega32L
5. Some Leds(unipolar,bipolar)
6. Resistors(470 ohms)
7. Breadboard
8. Switch(Toggle switch)

So after collecting all of them it is now time to start work. At first you have to know details about ATmega32/L. So collect the data sheet of it and read first four or five pages. That's enough for now.



First of all some description of the ATmega32 IC. ATmega32 is a 40 pin package. It has 32KB of programmable memory. That is you can load a hex file maximum of 32 KB on your IC. For both hobbies and professional this is enough. It has four ports for input and output. Namely PORTA,PORTB,PORTC and PORTD. Every port has 8 pins for I/O. All the ports are capable of both input and output. That is you can use a port for both input and output.

Software Installation:

1. Install avr-gcc
2. Install avr studio

After installing the softwares, open avr studio. Select new project, select avr-gcc as your compiler, select avr simulator and the appropriate version of ATmega(for this tutorial it is ATmega32). That's all.

It's the end of the first tutorial. In the next tutorial we dive into programming part.

Download Link:


AVR-GCC Compiler

AVR Studio 4

All the next tutorial will be found at the following link
ATmega32 Tutorial