Hello World Program

As in any programming language the basic program is to print Hello World, the basic program in embedded system is to blinking led.

The program is divided into two section

  • Setup Part : This consist of initialization of necessary setting for the avr which is only run once during program execution.

  • Loop Part : This consist of instruction which control the application , the are executed infinitely.

Source code:

//code to blink an led in avr

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

int main()
 { 
//setup part
   DDRA = 0b11111111;
    
   while (1){
//loop part
      PORTA = 0b00000000;
      _delay_ms(1000);
      PORTA = 0b11111111;
      _delay_ms(1000);
      
    }
      
   return 0;
 }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22