WebbotLib AVR library
WebbotLib It just does it
  C++ documentation  C documentation

Getting started with AVRStudio

Create your new project with AVR Studio as normal. If you don't know how to do that then read the AVR Studio manual.
In order to use the library you need to tell AVR Studio where the library has been installed. From the 'Project' menu option choose the 'Configuration Options'. This will open up a new window.
avrstudio1.jpg
You need to make sure that the 'Device' and 'Frequency' fields contain the correct values for your board. So for example: for an Axon the device should be 'atmega640' and the frequency should be '16000000'. If you forget to set these to the correct values then you will get an error when trying to compile the program.
The next steps may be new to you so please read carefully.
When using libraries many people copy the files that they want out of the library directory and paste them into their own project directory. This is very bad practise and you should avoid doing it. Otherwise: if you download a new version of the library then you need to copy the files to all of your projects. As well as taking up unnecessary disk space it quickly becomes unmanageable. So here is how to avoid it.
Click on the 'Include Directories' button on the left hand side of the window.
 
avrstudio2.jpg
You will now see something like this ie the list of included directories is blank. So now we tell AVR Studio how to find the header files for my library by adding the installation directory to the list. So click on the 'new' button at the top right of the window. This will allow you to type in a directory name such as 'C:\WebbotLib'. Alternatively: you can click the '...' button at the right hand side of the line so that you can browse your computer to locate the correct directory. Having done that we move on to the next step by clicking the 'Libraries' button on the left hand side of the window.
 
avrstudio3.jpg
This window allows you to specify the precompiled libraries you want to add to your project. The main windows has three lists:-
1. The top list allows you to specify the directories where your precompiled libraries are stored.
2. The bottom left window shows all of the precompiled libraries that AVR Studio knows about and they all start with 'lib' and end in '.a'.
3. The bottom right window shows the list of libraries that you want to include and will be blank by default.
In the top window: click on the new button and insert the installation directory (just as you did earlier). Assuming that you have selected the correct directory then the bottom left window should now also show the WebbotLib libraries for each processor as follows -
 
AVRlib 3.jpg
Select the appropriate library for your processor. The one that you use should be the same one as the 'Device' you specified in the very first window. So for the Axon you should use 'libWebbot-ATMega640.a'. Copy it to the bottom right window by clicking the 'Add Library->' button.
Next you should do the same thing to copy 'libm.a' and then 'libc.a' but do not copy any of the other libraries (unless you are an advanced user and you know that they are needed).
The bottom right window should list the libraries in the following order:-
1. Your chosen libWebbot-ATMegaxxx.a
2. libm.a
3. libc.a
NB If they are shown in a different order then you can use the 'Move Up' and 'Move Down' buttons to change the order. FAILURE TO PUT THEM IN THIS ORDER WILL CAUSE COMPILE ERRORS.
Your window should now look like this:-
AVRlib 4.jpg
Ok we are all done so you can click the OK button.

Valid XHTML 1.0 Transitional