
Installing Software But before we can start programming your robot, you need some software.Ideally, I would like to give you just one single program to download and everything will work right away. This is the idea of WinAVR (22.8mb), as when you download it (yes, please download and install it), you get everything you need in one go. It will install a bunch of useful programs all in one location, including GNU Compiler Collection (GCC), GNU Binutils, avr-libc, avrdude, avrice, and a few others. Its all seamlessly built in, so I wont even bother you about them. For more information, check out the WinAVR user manual. Don't install Programmers Notepad, its useless if you use AVR Studio, and has been know to be buggy in previous versions.

The next program I will have you download is an IDE (Integrated Development Environment). Atmel (the producer of the microcontroller you are using) offers this software, AVR Studio, for free. This IDE has a built in editor, compiler, uploader, etc all in one package.

Now that we have installed all the essential software, lets set up AVR Studio. Find the new AVR Studio 4 icon in your start menu, click, and you should immediately see this window come up:

The next window that comes up will look like this:



SOURCE CODE Now you need to download the source code. Currently, I offer just one program for your robot, but plan to come out with others later:Photovore v1.zip (March 10th, 2007) - Case-based photovore program

Now we need to add in the source code that you downloaded for AVR Studio. Right click 'Source Files' and left click 'Add Existing Source File(s)...'.

Now we must set up the options to compile your source code. Go to Project -> Configuration Options.


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. But after that, if you only make changes to the .c source file, you only need to do the faster Build command.


Now we need to upload the .hex file you just compiled to the microcontroller via the AVR STK Serial Port Dongle Programmer. To do this, you need to download the newest version of PonyProg2000: v2.06f BETA. For more info on the program, check the PonyProg Documentation.




Plug in your AVR STK Serial Port Dongle Programmer to both your computer and your robot if it isn't already from Step 3C. AFTER plugging your robot in, turn on the microcontroller by flipping the ON/OFF switch, or plugging in the battery if it doesn't have one. If you were to unplug the programmer, make sure you turn off your robot first.Now select 'Write All' from the drop down menu. A Yes/No window will come up, select Yes. Wait while the program uploads.


update: There is a known problem with PonyProg2000 that it won't work with a USB to serial adaptor. You might also be interested in this forum post,After programming, hopefully, your robot now suddenly tries to commit suicide by driving off your table. Your are done! Congratulations! Optional: Dont want to risk the problems some are having with PonyProg2000? Want to upload your program to your robot in under 30 seconds? You could buy the much more expensive (~$34) AVR ISP 2 programmer that is supported by Atmel (Digikey part # ATAVRISP2-ND). Its a much better programmer and supports many other Atmel microcontrollers. You also wouldn't need the PonyProg software and instead could directly connect with AVR Studio:

Common Compiling Error I repeatedly see this question asked in the forum. If you see the below error when you compile, it is because you didn't follow the directions carefully enough. Make sure you name your files and folders properly.
Photovore_v1.c:108: fatal error: opening dependency file .dep/Photovore_v1.o.d: No such file or directory compilation terminated. make: *** [Photovore_v1.o] Error 1 Build failed with 1 errors and 0 warnings...
0 comments:
Post a Comment