|
||
Search Here
MISC
SKILLS
HARDWARE
SCIENCE |
Installing Software
NOTE: THIS IS THE OLD SETUP INSTRUCTIONS
Although the Axon II can be setup just like the original Axon, the new method offers many advantages.
STEP 1: Install WinAVR While waiting for your Axon II to arrive in your mail, here are several programs you need to download and install to make full use of your Axon II microcontroller. Follow the self-explanatory installers. WinAVR will install the GNU Compiler and a ton of useful utilities. On the download page, select the latest release (bottom of list). WinAVR (22mb) Version 20090313 has been verified to work with the Axon.
STEP 2: Install AVR Studio AVR Studio is an IDE, assembler, and programming software all in one. When you want to write and compile code, this is the software you will be using. AVR Studio, version 4.17 (112mb) Further AVR Studio upgrades (untested by SoR) can be found on the AVR Studio Download page. Or for direct links to download tested upgrades go here. Because AVR Studio is not compatible with Mac or Linux, you might find this post and this post helpful. If you use Vista 64 bit, read this and this. And here are instructions for programming the Axon using Ubuntu.
STEP 3: Download WebbotLib WebbotLib is a new powerful library for AVR-based microcontrollers such as the Axon and Axon II. It offers many advantages over the original Axon library.
WebbotLib:
Everything you need to know about WebbotLib is in the WebbotLib manual (included in download as pdf). 1) To install, first download the latest version here: download WebbotLib (4mb)
2) create a folder called WebbotLib. Make sure there are NO spaces in the file/directory name.
For example, do not do
Also, the project file name must be the same name as the initial file. These are 'features' (bugs) in AVR Studio that will cause you problems otherwise!
The recommended directory is:
3) Extract all files from the zip file into your folder.
a_on(); //turn on LED a b_off(); LED_all_off(); LED_one(); //turn on #1 LED_three(); LED_on(); //turn on status LED WebbotLib is updated regularly - always try the latest version before reporting a bug. To keep updated, subscribe to this forum thread, but DO NOT POST SUPPORT QUESTIONS IN IT.
STEP 4: Start a new Project Now we need to start a new project. Find the new AVR Studio 4 icon in your start menu, click, and you should immediately see this window come up:
Select 'New Project' The next window that comes up will look like this:
Copy the options that I have chosen, but whatever file name you like. Remember to choose a file name and directory without spaces! Optionally, if you want a simulator (not required), click Next>> and choose these options:
Click Finish. AVR Studio should now look something like this:
STEP 5: Setup WebbotLib Now we need to tell AVR Studio to use WebbLib. Go to Project -> Configuration Options.
Set the microcontroller to ATmega640, frequency to 16000000 (16MHz), and optimization to -0O. No makefile. It should look like this:
Now click the Include Directories icon, and browse for your WebbotLib folder. This tells AVR Studio where to look for your common files.
Lastly, we need to declare three more important library files. Click on the Libraries icon and add the WebbotLib folder as before. Next, use Add Library-> to add libWebbot-ATmega640.a. This file MUST COME FIRST. Then add libc.a and libm.a. Your window should look like this:
Push OK. WebbotLib is now set up to use.
STEP 6: Add Source Now lets add some code to begin programming. Download the Axon2 example programs. Use the photovore sample code for this step. Copy/paste all code in Photovore.c into the .c file with the same name as your project (found in Source Files on the left). For example, if your project is called 'Axon2_WebblotLib', paste the code into Axon2_WebbotLib.c. Push the 'Save' icon at the top left in AVR Studio. This is the main() file. Now, right click 'Header Files' and left click 'Add Existing Source File(s)...'.
Add hardware.h from the photovore example folder. You could also just drag and drop. If you ever create new files, only label them as .h. The compiler can get confused with multiple .c files and result in strange compiling errors.
STEP 7: Compile Code The final programming step is to compile the code. This converts your code written in C to machine code in a .hex that only your specific microcontroller can read. You should do a Rebuild All the first time you compile the downloaded source code, or manually replace any program files. But after that, you only need to do the faster Build command.
If all went well, you should see this message after compiling. It shows you how much memory you have used:
If you get errors, and you are new to programming, it may be a little difficult to debug at first. Go back and check to make sure you followed all the steps, especially properly naming the files (a common error). Note that a new .hex file can be found in your project folder. This is the compiled program that will be uploaded to your microcontroller. Whenever you modify your program, just click 'Build' and it will recompile a new .hex for you. Don't forget to Save before recompiling. Note: A common error you may get is
"gcc plug-in: Error: Object file not found on expected location C:\Documents and Settings\User\My Documents\My_Robots\[your project name]\[your project name].elf
Make sure your makefile specifies the output .elf file as [your project name].elf"
If you get that error, it means you made a mistake naming your files. Start at the beginning, and read instructions more carefully.
STEP 8: Save Everything Lastly, save your project configuration.
Now that you are done setting up software, continue for
|
|
Has this site helped you with your robot? Give us credit -
link back, and help others in the forums! Society of Robots copyright 2005-2014 |