The first “Hello World!” project I prefer for Microcontroller is LED Blinking. I have used AVR  microcontroller .  Here,All pins of PORTB declared as output.

Source Code

Here,i have  written code  in C using AVR Studio 5.0.

/*
* ledblinking.c
*
* Created: 3/30/2011 9:36:30 AM
*  Author: sfg
*/

#include <avr/io.h>
#include <util/delay.h>

int main(void)
{
DDRB=0xFF; //all pins of PORTB declared as output
PORTB=0x00;
while(1)
{
//TODO:: Please write your application code
PORTB=0xFF;  //High State
_delay_ms(200); //delay
PORTB=0x00; //low state
_delay_ms(200); //delay
}
}

Circuit

Led blinking With Atmega32

Comments on: "Led blinking program with ATMEGA32 and AVR Studio 5.0" (18)

  1. Ismail Saeed Kamal said:

    waw it is the first tutorial to be posted it is the good starting
    but please try to post the avr studion5 GUI include in this tutorial windows and you can send me on my email by
    ismailkamal2009@gmail.com
    thanks very much

  2. Devin Wagner said:

    I tried compiling this program in studio 5 and it gives me a “Inconsistent operand constraints in the ‘asm’ ” inside that delay header. What is the problem here?

    • Moududur shamim said:

      some macro or variable declaration problem occurs.

      Send your code to me,I will check.

      Thanks

  3. thanks for the sample code!!!

  4. this is so helpful. thanks for sharing. soft starter

  5. Hello guys,

    this link http://ww.thiems.eu/prangelsatz is a project at our university in Germany, Bocholt.

    The content is about the Prangelsatz. This is not a real word, so google doesn’t know anything about this, if the project has been started.

    After we and our class member implement pages about the Prangelsatz, google recognize this word.

    So if you want do some good things, click on the link above and comment what is good or bad on our page.

    Greats,

    Sebastian

  6. Is this alll u can code?? are u 5th std student??

  7. hey can u delay the time for more than 1 minute

  8. Sumanta Kumar Show said:

    Myself Sumanta, is trying to implement the program of BLINKING LED in AVR studio4 with

    ATMEGA32. But a problem is occuring there. After burning of the program, the LED is not

    blinking but remaining in ON position. Please suggest me if there is anything wrong with the

    program or any other settings. If possible Email or SMS me.

    Email Id- (sumanta.show@gmail.com / show.sumanta@rediffmail.com)

    Mobile no.- (9932582375)

  9. try this one. remember to use same ports for LED’s i use two LED’s for this.

    #include
    #include
    int main(void)
    {

    DDRB=0b00000011; //initialize pin 1 and 2 on portb as output.

    PORTB=0x01; //start value for portb.

    while(1)
    {

    PORTB=0x02;
    _delay_ms(2000);
    PORTB=0x01;
    _delay_ms(2000);

    }

    }

  10. Can u help me to implement z above circuit using mux/demux? thanx

  11. I truly prize your piece of work, Great post.

  12. this use C code programmed..can u show me the AVR Assembly code for this project…dot asm language…thx

  13. Will you help me how to control serial 8 leds, only uses one digital port. thanks

  14. This is great tutorial to get started with AVR microcontrollers. I found here some more avr microcontroller based projects. you can check these projects, they are explained with circuit diagrams and codes.

  15. Nice tutorials. Please start posting again

Leave a comment