25 Jul 2009 @ 3:43 AM 
 

LED blinking AVR

 

Blinky Program for AVR LED is connected to PORTC_5 in sinking mode that is active low.

#include<avr/io.h> // Header file for basic avr input/output

#include<util/delay.h> // header file for delay generation

#define BV(x) (1<<x)

int main(void)

{

DDRC=0xFF; //portc declared as output

PORTC=0xFF; // PORTC is initially high to off the led initially

while(1==1) // infinite loop as 1 is always equals 1

{

PORTC=~(BV(5)); // led glow here

_delay_ms(1000); // one second delay

PORTC=BV(5); // led not glow here

_delay_ms(1000);

}

return 0;

}

Categories: Uncategorized Posted By: admin
Last Edit: 30 Jul 2009 @ 11 30 AM

EmailPermalink
 

Responses to this post » (None)

 

Post a Comment

You must be logged in to post a comment.

More Options ...
Change Theme...
  • Users » 4
  • Posts/Pages » 19
  • Comments » 1
Change Theme...
  • Void
  • Life « Default
  • Earth
  • Wind
  • Water
  • Fire
  • Light

About Me



    No Child Pages.

Guest Book



    No Child Pages.