Getting Started

(lily) #1

Chapter 2: Quick Start Guide


C


  • e, then New, then C/C++, and name it Blinky.c.
    PE exactly as shown:


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

int main (void)
{
// set PORTD for output
DDRD = 0xFF;

while(1) {

for(int i = 1; i <= 128; i = i*2)
{
PORTD = i;
_delay_loop_2(30000);
}

for(int i = 128; i > 1; i -= i/2)

;
op_2(30000);


  • Open File and again save ‘Blinky.c’ to your Blinky directory





  • lick OK.
    Click Fil

  • Save in Blinky directory and CAREFULLY TY


// Blinky.c

{
PORTD = i
_delay_lo
}
}
return 1;
}


  • NOTE: YOU MUST ADD THE EXTENSION ‘.c’ TO THE NAME
    Open the file ‘makefile’ in your Blinky directory.
    Change these lines:


MCU = atmega128

# Output format. (can be srec, ihex, binary)
FORMAT = ihex
Free download pdf