Using The Arduino Uno With Eclipse
Using The Arduino Uno With Eclipse
WITH ECLIPSE
IMPORTANT:
Note the “COM” port
OVERVIEW
Step 1: Installing WinAVR
(continued…)
“INSTALLING” ECLIPSE
The executable is located in D:\eclipse. Double-click to start Eclipse.
D:\eclipse
executable
(continued…)
USING ECLIPSE Build Icon
Pressing this button results in a “build” of
the active project. The result of a
successful build is a “.hex” file which can
be uploaded onto the UNO board.
Upload Icon
Project Explorer Pressing this button sends the program
All projects in the current workspace (in the form of a “.hex” file) to the
(ARDUINOworkspace) are shown here. ATmega328p on the UNO board.
Only the selected project is “active”.
Console Window
Messages from the compiler, linker, and
Problems Window programmer will be displayed here.
Displays warning and error messages
that result from the build process.
BUILDING A PROJECT
The project “testArduinoUNO” has been included as a sample project
Expand the project in the Project Explorer. You should see the following:
(continued…)
BUILDING A PROJECT
To build the project, click the build icon
The build may take a minute or two
The build process generates several files, which can be seen in the Project
Explorer window:
Change the “Override default port (-P)” setting to the correct COM port, and
select “OK” (twice)
For example, the correct setting for COM5 would be: //./COM5
TESTING THE UNO
Connect your Arduino UNO board to your laptop
Press the upload icon
Select “Next”
(continued…)
CREATING A NEW PROJECT
Click the “Advanced Settings” button
Expand the “AVR” arrow and select “AVRDude”
Under “Programmer configuration”, use the drop-down box to select
“ArduinoUNO”
(continued…)
CREATING A NEW PROJECT
Set the MCU Type to “ATmega328p”
(continued…)
CREATING A NEW PROJECT
We now need to add a source file (.c)
From within the Project Explorer, right-click on your project and select
“New – Source File”
Choose “Finish”
CREATING A NEW PROJECT
The source file is now part of your project and will be used
during the build process.
CONFIGURE SETTINGS
EDIT CODE
in C Source File
BUILD
TEST and DEBUG
Executable Hex File
UPLOAD
Hex File to UNO
USING THE “MSOE” SUPPORT FUNCTIONS
Within “D:\ARDUINOworkspace” is a directory named “MSOE”
containing a variety of functions:
delay.c – time delay functions
lcd.c – LCD control functions
bit.c – general purpose functions
Next, we will modify our program to allow precise timing of the “blink”
(continued…)
USING THE “MSOE” SUPPORT FUNCTIONS
Step 1: Tell Eclipse the location of the MSOE support functions
Select “Project” then “Properties”
Expand the “C/C++ General” arrow and select “Paths and Symbols”
In the “Includes” tab, “Add” an Include directory “D:\ARDUINOworkspace”
Select “OK”
You may be prompted to “rebuild”. Choose “Yes”.
(continued…)
USING THE “MSOE” SUPPORT FUNCTIONS
Step 2: Include the MSOE support functions in the source code
We will use the “delay_ms()” function to control the timing
The function source code must be “included” within our program
The function itself is contained in a file called “delay.c”
(continued…)
USING THE “MSOE” SUPPORT FUNCTIONS
delay_ms(500);
Produces a 500 millisecond delay
(continued…)
USING THE “MSOE” SUPPORT FUNCTIONS
Save your program and build it!
Select “OK”
CONGRATULATIONS!!!