Back

/*********************************************************************

                 xBoard2 Sample Programs
               ---------------------------


Description :  Simple program to blink led on PORTD7.
            
            
            NOTE: PLEASE SHORT JUMPER J1 (THIS WILL CONNECT LED WITH PD7)

            If you don't get the Tricks of Logical Operators
            (like & and |) please see

http://extremeelectronics.co.in/avr-tutorials/programming-in-c-tips-for-embedded-development/

            For Getting Started with AVR MCUs see

            http://extremeelectronics.co.in/category/avr-tutorials/


Author      : Avinash Gupta
Web         : www.eXtremeElectronics.co.in
                   
**********************************************************************/

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

void Wait(uint8_t delay)
{
   //Delay Function

   uint8_t i;
   for(i=0;i<delay;i++)
   {
      _delay_loop_2(0);
   }
}
void main()
{

   //Set the PORTD7 as output
   DDRD=0B10000000;

   while(1)
   {
      PORTD|=0b10000000;   //Binary value 1=LED off

      Wait(30);

      PORTD&=0b01111111;   //0=LED on.

      Wait(30);


   }
}

Top