Monday, November 13, 2017

AVR LED blinking - 1

Name: LED Blinking
Microcontroller: ATMEGA16
Description: This is very simple hello world poject.  All the pins of Port-D will be ON and OFF semultenously with one second interval.

Code:
void main()
{
  DDRD = 0xFF;           // Set the port-D as output
  do {
       PORTD = 0x00;        // Turn OFF LED on PORTD
       Delay_ms(100);        // 1 second delay
       PORTD = 0xFF;        // Turn ON LED on PORTD
       Delay_ms(100);        // 1 second delay
       } while(1);                  // Endless loop

}

No comments:

Post a Comment