You Are Here: Home » AVR ATmega Projects » LED Projects » LED Blinking with ATmega32 Microcontroller

LED Blinking with ATmega32 Microcontroller




Blinking LED is the first step you would like to take to get started with electronics. In this tutorial we are going to connect an LED with ATmega32, which is an AVR series microcontroller. We are going to blink the LED at half a second rate.

LED Blinking with ATmega32 Microcontroller

Blinking LED with ATmega32 AVR Microcontroller

Components Required

 Hardware:




ATmega32A Microcontroller

Power supply (5v)

AVR-ISP Programmer

100uF Capacitor

LED

220Ω Resistor

Software

Atmel studio 6.1

Progisp or flash magic

Circuit and Working ExplanationSchematic LED Blinking with ATmega32 Microcontroller

As shown in circuit, there is no need to connect an external crystal here. Because the ATMEGA works on internal 1MHz Resistor-Capacitor oscillator on default. Only when the accuracy of clock is needed, as application of high precision counting, external crystal is attaches. When the controller is first bought, it is fused to work on internal crystal by default.

The resistor is connected here to limit the current drawing from the LED. Remember, the controller can not provide more than 30mA at the terminals.

Programming Explanation

#include <avr/io.h> //header to enable data flow control over pins

#define F_CPU 1000000 //telling controller crystal frequency

#include <util/delay.h> //header to enable delay function in program

int main(void)

{

                       DDRD = 0xFF; // ( or 0b1111 1111) In AVRSTUDIO for  telling the controlling to use a certain bit of a port as input we use “ZERO”, for telling it to use a certain bit as output we use “ONE”. Since we put eight “ONE’s”, all the pins of PORTD are enabled as output. If we put a zero as “0b1111 0111”, now all the pins 0,1,2,4,5,6,7 are enabled as inputs and PIN 3 is Enabled as input.

For more detail: LED Blinking with ATmega32 Microcontroller

Leave a Comment

You must be logged in to post a comment.

Read previous post:
Interfacing LCD with ATmega32 Microcontroller
Interfacing LCD with ATmega32 Microcontroller

To establish a good communication between human world and machine world, display units play an important role. And so they...

Close
Scroll to top