Free Programming Books
Free download ebooks on computer and programming

Free Ebook "Extreme MINDSTORMS: An Advanced Guide to LEGO MINDSTORMS" Sample Chapter

Extreme MINDSTORMS
Download Free Chapter 4: RCX 2.0 Firmware
Download chapter

Three MINDSTORMS experts have joined with the maintainer of the legOS HOWTO to produce the book that all advanced users of LEGO MINDSTORMS have been waiting for. Each author has written material based on his specialty. Dave Baum shows you how to take NQC to its limits. Ralph Hempel explains the ins and outs of pbForth. Michael Gasperi teaches you how to build numerous custom sensors with simple, systematic instructions. Luis Villa show you how (and when) to upgrade MINDSTORMS' built-in operating system to take advantage of the extra power of legOS, a complete C environment for the RCX.

Extreme MINDSTORMS: An Advanced Guide to LEGO MINDSTORMS starts with an overview of the RCX firmware and includes a whole chapter on the new RCX 2.0 firmware. Next, the book concentrates on the steps needed to build Seeker, a Light-Seeking Robot, and to program it in NQC. Later chapters extend Seeker's functionality using pbForth and legOS. The book concludes with two chapters on building both custom passive and custom powered sensors. These sensors can take LEGO MINDSTORMS to levels impossible to achieve with just the parts supplied in the box or available through normal channels.

< < prev 

RCX 2.0 Firmware

IN THE FALL OF 1998, LEGO released their first MINDSTORMS set: the Robotics Invention System (RIS) 1.0. The following year, a new version of the set (RIS 1.5) was released. This new version featured a number of improvements to the RCX Code software, to the documentation included with the set, and it included a few new pieces. The RCX itself was slightly different physically (it had no external power connector), but the firmware remained unchanged.

LEGO is planning another update to the RIS. As of this writing, LEGO has not announced an official release date, but an educated guess is that RIS 2.0 will be available early in 2001. Most of the specifics of RIS 2.0 are also unknown, but one thing is certain: the RCX will get new firmware. Furthermore, this new firmware can be used with existing RCX's, which is good news for owners of RIS 1.0 and RIS 1.5. As an added bonus, this new firmware is available today (albeit in pre-release form). In March of 1999, LEGO made an early version of this firmware available to the public as part of the RIS 2.0 pre-alpha SDK (Software Development Kit). Among other things, the SDK contains the RCX 2.0 Firmware, which can be easily downloaded to any RCX.

The RCX 2.0 Firmware adds a number of new capabilities to the RCX. Presumably, the programming environment for RIS 2.0 will utilize these new capabilities. However, you can get started today by using either the tools contained in the SDK or by using NQC. This chapter will explain some of the major new features and illustrate using them in NQC.

Getting Started

In order to start working with the RCX 2.0 Firmware you will need two things: the firmware itself, and a version of NQC that supports the new features (version 2.2 or higher).

The firmware was initially made available as part of the RIS 2.0 SDK, which can be downloaded from the MINDSTORMS Web site at http://www.legomindstorms.com. However, Web sites change much faster than books, so the specifics of getting this software from the MINDSTORMS site may change. Future MINDSTORMS products will also include the new firmware, so if you are an RIS 2.0 user you already have the new firmware and it has probably been downloaded to your RCX. The firmware is contained in a file named FIRMxxxx.LGO, where xxxx is the firmware's version number. For example, the original firmware was version 3.0.9 and thus named FIRM0309.LGO. As of this writing, the most recent version of the new firmware is FIRM0328.LGO (version 3.2.8).

The new firmware is compatible with the original firmware, so all of the existing tools and programs for the original firmware should also work with an RCX running the new firmware. However, to take advantage of the new features using NQC, you will need NQC 2.2 or higher. The latest version of NQC can be found at http://www.enteract.com/~dbaum/nqc. If you want to determine the version of NQC you are currently using, just type the following command:
nqc
In order to download firmware to the RCX you should use either the -firmfast or -firmware options for NQC. As its name implies, -firmfast will be faster, but it is also more susceptible to interference. In general, try firmfast. If that doesn't work, step back to -firmware. You will also need to specify the firmware file to be downloaded. For example, if the firmware file was named FIRM0328.LGO and located in your current directory, you can use either of the following commands to download it:
nqc -firmfast FIRM0328.LGO
nqc -firmware FIRM0328.LGO
After a successful firmware download, NQC will query the RCX and report the versions of the ROM and the firmware. For example, after downloading FIRM0328.LGO you may see something like this:
Current Version: 00030001/00030208
This indicates that the ROM version is 3.0.1 and the firmware version is 3.2.8. The features discussed in this chapter apply to firmware versions 3.2 and higher. When compiling a program with NQC you need to tell it if you want to generate code for the original firmware or for the new RCX 2.0 Firmware. You can do this with the -T<target> option, where <target> is a name that specifies where you plan on running the program. NQC supports a number of different targets, but the most important ones (for RCX owners) are rcx and rcx2, which specify, respectively, an RCX running the original firmware and an RCX running the 2.0 firmware. If no target is specified, the default is the original RCX, although this may change in later versions of NQC.