Creating a sample AVR C File

Once a project has been created you can start adding C source files to it. For this tutorial we add a very simple programm, that actually does nothing, but is compatible with all AVR series processors.

To create the file:

  1. In the Project Explorer view, right-click the AVRtest project folder, and select New > Source File.

  2. In the Source File field, type main.c.

  3. Click Finish.

  4. Type the code in the editor. (or copy and paste it from here)

    int main(void)
    {
        while (1)
        {
            __asm__ volatile("nop");		// so the endless loop isn't optimized away
        }
    
        return (1);	// should never happen
    }
    

  5. Click File > Save.

The file is now ready for building.

Next: Building your Project

Back: Creating your project