CEENBoT Flashlight Project – Setting up the IDE (Atmel Studio 6)

WARNING: Windows 8 users – While installing, you will need to be in a special boot mode of Windows. This is called “Disable Driver Signature Enforcement” in your advance boot menu. I suggest doing this now! Click here for how.

Today, for my seminar class, I was assigned “fun” in the form of developing a program on the CEENBoT I assembled in an earlier class. This was designed to have some “fun” over Spring Break. Nerdy, I know, but it does sound fun. I was given instructions on some addition functionality of the CEENBoT that I acquired and assembled. I’m going to try and detail various things about the project just for blogging purposes and to document what I might need to remember later. Who knows, you might like it to?

The original idea was given here. The idea is to create a circuit on the breadboard that consisted of two photo-resistors, and allow them to control the turning of the robot. For those not familiar with the CEENBoT product, you can review it here.

The first thing to note is that Atmel, the provider of the programmable logic controller, upgraded from the studio suite used in class (Typically Atmel Studio 4 at University of Nebraska Omaha, or CEENBoT Commander which is a visual drag and drop interface to allow certain programming capabilities to younger generations) to Atmel Studio 6. There are large differences in this suite, not just graphical. The studio suite is now based on Microsoft’s Visual Studio programming IDE. This is great to get closer to professional development of desktop applications, not so much for those that are just starting out.

First, you need to download the IDE. Click here to go to Atmels website. At the time of this writing, you want to download “Atmel Studio 6.0 with Service Pack 2 (build 1996) Installer – Full”. Once downloaded, you should be able to run the program file to get it installed. Run the program once installed.

You will now be given a screen like:

IntroScreen

Next you will need to download the API library and header files (here). You will need to use a utility to “unzip” this anywhere. Windows typically allows you to right-click and “Extract All”. Once this is done, we now need to create your first project! Back in Atmel Studio 6 (or Visual Studio or VS for short), click “New Project”. You’ll get a screen like this:

NewProject

You can name your project anything you like and store it anything you like, otherwise keep everything else the same. Next you’ll be presented with a screen asking for the controller you’re programming for. Mine is the ATmega324P, you can confirm which yours is on the board of the CEENBoT.

ControllerSelect

You’ll now be given your main programming code. We aren’t done yet though. We have to tell VS to use the libraries you downloaded. Right now VS thinks you’re just programming the controller, when the CEENBoT has all these nice features, like wheels, LCD screen, switches and IR boards. You’ll want to go to the top, click Project –> <Project Name> Properties. Now you’ll get something like this:

ProjectProperties

OK, now here’s where it’s hard to understand what’s going on, so follow along with the pictures if you get lost. On the left hand side, click “Toolchain”. A new window populates on the right hand side. There is a list of options within it, to which you want to click on “Libraries” under “AVR/GNU Linker”. The window will look like this:

LinkerLibraries

Click the circled add button. This tells VS that we want to point it to an external library, a collection of code given to us by the makers of CEENBoT. Point this to the CEENBoT API folder you extracted earlier, not the lib-includes. You’ll see this file system path show up under Library search path. Next click the top “Add” button, identical to the first one you clicked, just above it. You want to add “libcapi324v221” in the box. After all is said and done, you should have a window like this:

FinalLibraries

We’re almost there! Now we need to tell VS how to use the library and give us the ability to use it in our code! Click “Directories” under “AVR/GNU C Compiler”. Click the “Add” button identical to the ones we clicked before and point this to your “lib-includes” folder that was extracted earlier.

IncludeDirectory

OK! Now we are ready to program the CEENBoT! To test this out, go ahead and edit your .c file to look like this:

#include "capi324v221.h"
void CBOT_main(void)
{
while(1)
{
//TODO:: Please write your application code
}
}

This is a simple program that does nothing. This programming is explained in more details in the getting started guide, downloadable from the page above where you got the API headers. Once this is in your .c file, you can now save (Control S, I find, is very useful.) and then go to Build –> Build Project (or hit the F7 key.) Once your computer is done working, you should see

Build succeeded.
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========

If there are any errors listed, you might be able to Google the error to find out what happened, but most likely you clicked on something incorrectly and send the wrong folders to the wrong parts of the configuration.

Next article: How to flash your CEENBoT without making it a paperweight!

%d bloggers like this: