(edit sidebar)
Intro to Physical Computing Syllabus

Research & Learning

Other Class pages

Shop Admin

ITP Help Pages
Tom's pcomp site
DanO's pcomp site


Installing Eclipse

Brief intro here, why C is useful for microcontroller programming. Cite a couple of examples that you can't do with Arduino, to be shown later on. For example:

  • using Atmegas other than the 8 or 168 (e.g. 128, 1281, ATtiny, etc)
  • what else?

This is where we begin with writing C. First we are going to set up our environment.

You are going to need a few things:

The most recent build of Eclipse (available here)

Decompress the file and there is your Eclipse. It will exist just about anywhere you put it. Fire it up and watch the fireworks.

This will be the first thing you see.

Attach:image of welcome screen

Select "workbench", the next thing you see is the environment. Before you start rockin the code, let's do a software update so that we can write in C.

Go to Help >Software Updates>Find and Install

You will be prompted with a dialog box with two options about the updates you want. You want to "Search for new Features to Install".

Click "next". Again, you are prompted with a dialog box bearing two options about where the updates you want can be found. The updates you are looking for are in the "Callisto Discovery Site". Check the box next to "Callisto Discovery Site".

Click "finish". Eclipse will call the internet looking for the updates. You will be prompted to choose a mirror site for your download. Choose whichever you prefer. Eclipse returns to the internet. and brings back the Callisto directory. If it is not already open, do so by clicking the triangle next to the name. The C/C++ package is at the top. Check the box next to the C/C++ package and click "next". If you accept the user agreement, Eclipse will download and install the package.

Restart Eclipse and go to the "workbench".

Go to File>New>New Project.

This opens a project Wizard where you will make several choices about the project.

A dialog box with the types of projects that are available. Open the folder labled "C". Inside are two options. Choose the "Managed Make C Project", and click "next". Name the project and click "next". Here you will choose the type. Choose "Executable", and click "finished".

Your project opens before you.

This is a good place for another screenshot. Eclipse also asks if you want to switch to the C perspective.

A folder will appear to the left, this is the project folder. Everyhing is documented here.

Go New>Source File. A dialog will appear, prompting you to give the file a name. Directly above is a warning dialog telling you what's immediately wrong with the name. Type in helloworld.c and watch the warning box change. This is a really good feature, and will come in handy in the future. Click "finish".

The source file opens in the middle window. Type this code in:

 //this is an include.  get used to these, they add functionality to your program
 #include <stdio.h>

 //this is your main loop
 int main(){
 //this is the printline statement
 printf("Hello World"); 
 //we have to return something. why not zero?
 return 0;	
 }

Before we run the code, look below the code window. There are three tabs, select the one labled "Console"

Select the project folder to the left.

Go Run>RunAs>Run Local C/C++ Application

In the Console the text HelloWorld will appear. I got an error, "Launch failed no binaries." Is there an instruction missing? It worked when I did a build first.

Congratulations, you have written your first C program.

Yay! So what tutorial do I do next? And how do I get it on to a microcontroller? Links to other tutorials here:

  • Getting started with AVR-gcc in Eclipse
  • blink.c on the Atmega168 or other Atmega
  • Some simple atmega examples
  • burning code on a microcontroller
  Edit | View | History | Print | Recent Changes | Search Page last modified on May 24, 2007, at 09:26 AM