
RP6 ROBOT SYSTEM - 4. Programming the RP6
Additional information can also be found on the WinAVR-Homepage and in the WinAVR
PDF-documentation, respectively:
http://winavr.sourceforge.net/
http://winavr.sourceforge.net/install_config_WinAVR.pdf
And especially the AVR-LibC documentation:
http://www.nongnu.org/avr-libc/user-manual/index.html
which can also be found as a PDF on the RP6 CD!
Of course you do not have to read all these tutorials and books! This list is only a
guide for gathering more information. Tutorials vary in size and details, but it cer-
tainly helps to read more than one.
A general AVR community and info page is
http://www.avrfreaks.net/
Here you can find a very nice forum dedicated to AVR Microcontrollers, lots of general
infos, projects, tutorials and code snippets!
4.4.2. First program
As already said - learning by doing is the most efficient way of learning the C lan-
guage. Having read and understood something in this crash course, you should try it
out by yourself!
Of course we will have to discuss a few basics before, but in order to give you an idea
of what we are talking about, let's just start with a simple C program for the RP6:
1
2
3
4
5
6
7
8
9
10
11
12
/*
* A small and simple "Hello World" C Program for the RP6!
*/
#include "RP6RobotBaseLib.h"
int
main
(
void
)
{
initRobotBase
();
writeString
(
"Hello World!\n"
);
return
0
;
}
If you have never programmed in C before, this “source code” may look like a foreign
language, but the basic concepts are easy to understand.
The tiny program above is already a complete functional program, but it only initial-
izes the microcontroller and writes the text:
"Hello World!"
+ Carriage Return / Line Feed
to the serial interface. This is a typical programming example, which may be found in
most books (of course not with the initRobotBase call at the beginning ;) ).
To get familiar with the new language, you may copy this small program into a text
editor by yourself and try to compile it.
- 63 -