Embedded Motion Control/Lego Mindstorms Installation: Difference between revisions
mNo edit summary |
mNo edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
This document describes | This document describes the installation of the necessary and sufficient software (approximately 400 MB) on Windows XP to start programming your own RCX from LEGO Mindstorms to control your ''Marslander''. After reading this small manual, you should be able to run your own program on the RCX. | ||
= Installing Cygwin and the IR Tower = | == Installing Cygwin and the IR Tower == | ||
The RCX will be running on Linux and hence you need to compile all your code under Linux. Therefore, | The RCX will be running on Linux and hence you need to compile all your code under Linux. Therefore, | ||
you can use a Linux emulator under Windows, called ''Cygwin''. To install this emulator, carefully follow the | you can use a Linux emulator under Windows, called ''Cygwin''. To install this emulator, carefully follow the | ||
Line 9: | Line 9: | ||
# In the following window, choose ''install from local directory''. | # In the following window, choose ''install from local directory''. | ||
# Then choose the directory where ''Cygwin'' should be installed, the other options should be left at the recommended ones. | # Then choose the directory where ''Cygwin'' should be installed, the other options should be left at the recommended ones. | ||
# Now the setup prompts for the local package directory, which is | # Now the setup prompts for the local package directory, which is <code>cygwin_install_files</code> on the cd-drive. | ||
# It is time to select the packages. It is preferred to install them all, so activate them all by clicking on ''All-default'' (the ''default''-part) until it says ''All-install'', and start the installation by clicking next. | # It is time to select the packages. It is preferred to install them all, so activate them all by clicking on ''All-default'' (the ''default''-part) until it says ''All-install'', and start the installation by clicking next. | ||
When this is finished, ''Cygwin'' is installed but you still need a special compiler and operating system for the RCX. Therefore do the following: | When this is finished, ''Cygwin'' is installed but you still need a special compiler and operating system for the RCX. Therefore do the following: | ||
# Click the button ''Directories to copy'' in the installation window of the CD. An explorer window will be opened with four directories, | # Click the button ''Directories to copy'' in the installation window of the CD. An explorer window will be opened with four directories, <code>build</code>, <code>brickos-0.9.0</code>, <code>etc</code>, and <code>usr</code>. Copy these to the directory you just installed ''Cygwin'' in (e.g., <code>c:\Cygwin\</code>). Choose yes when asked to replace. | ||
# You are finished, so choose ''Exit'' in the installation window of the CD. | # You are finished, so choose ''Exit'' in the installation window of the CD. | ||
Now you need to install the driver for the infrared communication tower. To do this, plug the IR USB | Now you need to install the driver for the infrared communication tower. To do this, plug the IR USB | ||
Tower in a free USB slot in your computer. Windows will automatically detect it, and prompts for a | Tower in a free USB slot in your computer. Windows will automatically detect it, and prompts for a | ||
driver. Don’t let Windows update but choose to install your own driver which can be found in the directory | driver. Don’t let Windows update but choose to install your own driver which can be found in the directory | ||
IR_Tower_USB on the CD. Now everything is ready to set-up the RCX. | <code>IR_Tower_USB</code> on the CD. Now everything is ready to set-up the RCX. | ||
= Putting a kernel into the RCX = | == Putting a kernel into the RCX == | ||
In order for the RCX to be able to run your programs, it needs to be provided with dedicated firmware. The RCX is equipped with a ROM chip on which the standard Mindstorms firmware is stored. Every time the RCX loses power (e.g. when changing batteries), the firmware which was running on the RCX is replaced by this standard firmware. Therefore, every time the RCX has lost power, the dedicated firmware has to be installed again. | |||
= Downloading your program to the RCX = | ''N.B.: If there is already a kernel running on the RCX (not the original one), then this one has to be deleted before a new one can be transferred to it. This can be done by pushing the Prgm button immediately after you push the On-Off button to swith the RCX off (this may take some practice).'' | ||
To install the firmware for BrickOS, power on your RCX, open a cygwin shell (it opens in <code>/brickos/marslander</code>) and type | |||
<code>firmdl3 ../boot/brickOS.srec</code> | |||
Now the kernel is being transferred to the RCX and when this is finished, your RCX is ready to be programmed with your own programs. | |||
== Downloading your program to the RCX == | |||
The programming language used to control the RCX is C. Suppose you wrote a program in C to display "hello world" on the LCD of the RCX. This simple file <code>helloworld.c</code> can be found in the marslander directory <code>/brickos-0.9.0/marslander</code>. In order to compile this code we use the command <code>make</code>. This command uses the <code>Makefile</code> already present in the same directory. Therefore, all your C-code should be put into that directory. To compile type | |||
<code>make helloworld.lx</code> | |||
This will start the compilation process and delivers (amongst others) the file <code>helloworld.lx</code>. This is the actual program that will run on the RCX. To download it to the RCX, type | |||
<code>dll helloworld.lx -p1</code> | |||
where the option <code>-pX</code> is used to specify the program number on the RCX, here number 1 (there is room for 7 different programs, hence X is in the range 1 to 7). The program is now loaded on the RCX and by hitting the run button, the text ''hello world'' will be displayed on the screen. A second program which plays sound (sound.c) can be compiled and downloaded to the RCX by typing | |||
<code>make sound.lx</code> | |||
<code>dll sound.lx -p3</code> | |||
You can now switch between these two programs (1 & 3) using the ''Prgm'' button on the RCX. |
Latest revision as of 09:57, 21 March 2011
This document describes the installation of the necessary and sufficient software (approximately 400 MB) on Windows XP to start programming your own RCX from LEGO Mindstorms to control your Marslander. After reading this small manual, you should be able to run your own program on the RCX.
Installing Cygwin and the IR Tower
The RCX will be running on Linux and hence you need to compile all your code under Linux. Therefore, you can use a Linux emulator under Windows, called Cygwin. To install this emulator, carefully follow the following steps:
- Insert the marslander installation CD and wait for the installation window.
- Choose Install Cygwin, and the installation program will start.
- In the following window, choose install from local directory.
- Then choose the directory where Cygwin should be installed, the other options should be left at the recommended ones.
- Now the setup prompts for the local package directory, which is
cygwin_install_files
on the cd-drive. - It is time to select the packages. It is preferred to install them all, so activate them all by clicking on All-default (the default-part) until it says All-install, and start the installation by clicking next.
When this is finished, Cygwin is installed but you still need a special compiler and operating system for the RCX. Therefore do the following:
- Click the button Directories to copy in the installation window of the CD. An explorer window will be opened with four directories,
build
,brickos-0.9.0
,etc
, andusr
. Copy these to the directory you just installed Cygwin in (e.g.,c:\Cygwin\
). Choose yes when asked to replace. - You are finished, so choose Exit in the installation window of the CD.
Now you need to install the driver for the infrared communication tower. To do this, plug the IR USB
Tower in a free USB slot in your computer. Windows will automatically detect it, and prompts for a
driver. Don’t let Windows update but choose to install your own driver which can be found in the directory
IR_Tower_USB
on the CD. Now everything is ready to set-up the RCX.
Putting a kernel into the RCX
In order for the RCX to be able to run your programs, it needs to be provided with dedicated firmware. The RCX is equipped with a ROM chip on which the standard Mindstorms firmware is stored. Every time the RCX loses power (e.g. when changing batteries), the firmware which was running on the RCX is replaced by this standard firmware. Therefore, every time the RCX has lost power, the dedicated firmware has to be installed again.
N.B.: If there is already a kernel running on the RCX (not the original one), then this one has to be deleted before a new one can be transferred to it. This can be done by pushing the Prgm button immediately after you push the On-Off button to swith the RCX off (this may take some practice).
To install the firmware for BrickOS, power on your RCX, open a cygwin shell (it opens in /brickos/marslander
) and type
firmdl3 ../boot/brickOS.srec
Now the kernel is being transferred to the RCX and when this is finished, your RCX is ready to be programmed with your own programs.
Downloading your program to the RCX
The programming language used to control the RCX is C. Suppose you wrote a program in C to display "hello world" on the LCD of the RCX. This simple file helloworld.c
can be found in the marslander directory /brickos-0.9.0/marslander
. In order to compile this code we use the command make
. This command uses the Makefile
already present in the same directory. Therefore, all your C-code should be put into that directory. To compile type
make helloworld.lx
This will start the compilation process and delivers (amongst others) the file helloworld.lx
. This is the actual program that will run on the RCX. To download it to the RCX, type
dll helloworld.lx -p1
where the option -pX
is used to specify the program number on the RCX, here number 1 (there is room for 7 different programs, hence X is in the range 1 to 7). The program is now loaded on the RCX and by hitting the run button, the text hello world will be displayed on the screen. A second program which plays sound (sound.c) can be compiled and downloaded to the RCX by typing
make sound.lx
dll sound.lx -p3
You can now switch between these two programs (1 & 3) using the Prgm button on the RCX.