headerImage

Contents

Introduction

pbForth is (yet another) incarnation of Forth. It is designed to work with the LEGO Mindstorms RCX brick. As an alternative firmware for the RCX, pbForth is unique for the following reasons:

Simple Cross-Platform Development Environment
pbForth is interpreted and compiled right on the brick itself. Once the firmware is loaded onto the brick, all you need is a terminal emulator that can send plain text strings to the RCX tower through the serial port. You can program your robots with Windows, Linux, or a Mac.
Small Memory Footprint - Big Memory Space
The pbForth firmware uses about 10K of the 28K of available space in the RCX memory map. This leaves 18K for your code and variable space. If you need lots of RAM for building navigation maps, data logging, or complex algorithms, then pbForth is for you.
Interactive Software Development
pbForth is designed for interactive software development. You build your LEGO robots one step at a time - why not write software the same way? You can write, test, and revise your programs on the fly to quickly build up confidence in your software.
Compiler Runs on the RCX
The most unique feature of pbForth is that the RCX brick runs the compiler. In the days of multi-megabyte installations for development environments, it's refreshing to find one you can find one that is small yet powerful.
Use Plain Text to Control The RCX
This is one of the hidden features in pbForth. Instead of formatting complex binary strings to control the inner workings of your RCX, a plain text string like BOT_FORWARD can be used to control your robot from the PC. Of course, you can also send plain text messages between RCXs if you're lucky enough to have more than one.

What's New or Changed?

I'll be the first to admit that the old pbForth had a few problems, not the least of which was a frustrating tendency to drop characters in script uploads. The new pbForth solves a number of problems that have crept up again and again in the past few years.

ANS-Forth Compatible
pbForth is written as an ANS compatible minimal Forth. That means that "standard" Forth programs can run on the RCX. More importantly it means that I have run a standard suite of over 800 tests on pbForth to ensure that it performs correctly.
No Multi-Tasking
The previous version of pbForth had a simple co-operative multi-tasker built in, but the new version does not. This may seem like a terrible shortcoming but in fact it is very easy to write a cooperative multi-tasker in standard Forth and add it to our system.
It turned out that the multi-tasking was adding an extra level of complexity that most users could not get past - and frankly was too complicated to explain.
Single Wordlist
One of the features of many Forth dialects is the ability to hold multiple dictionaries or wordlists. Most users never figure out how this works and don't really want this feature. If it's really necessary I will add it but right now it's just not worth the effort.
Improved Communications
The serial communications mechanism of the old pbForth was hastily cobbled together. It worked, but not very reliably. The problem of seeing your own echos from the tower and the RCX itself made things a bit more complicated!
The new pbForth uses serial code I rewrote from scratch, and takes the echoes from the tower and the RCX into account. In fact, when the RCX is transmitting serial data, the receiver is turned off, which makes it easier to discard echoes!
Finally, the main input loop uses XON-XOFF flow control so it's easier to handle script uploads without fixed line termination waits.
Integration with RCX Math Routines
The software engineers at LEGO provided the RCX with a bunch of helper routines. The pbForth system uses the obvious ones to control the motors, read sensors, and drive the LCD. There are also math routines for multiply and divide built into the RCX, and this version of pbForth makes extensive use of them. The result is blazingly fast fixed-point math.

pbForth in Education

pbForth is one of many alternative programming environments, but it's not just for experts. In fact, some of the most enthusiastic pbForth programmers are children. The RCX-Code that ships with the Mindstorms kit and RoboLab are two examples of graphical software for the RCX. They have limitations in terms of variable storage space and execution speed that limit their usefulness. Educators in Europe and North America are using pbForth to teach real programming principles to young children.

Martin Bitter in Germany
Martin and his students have been using pbForth since it was originally released. Martin teaches at a school for developmentally challenged kids - and they have succeeded in placing highly in regional robotics competitions. The computer budget for the classroom is very small, so Martin was happy to find out that pbForth programs can be developed on a '486 class machine and uploaded to the RCX using a simple terminal emulator.
Purdue University K-12 Outreach in Indiana
I had the pleasure of being lead instructor for 2 sessions of the K-12 Outreach program. We had 2 groups of 24 students ranging in age from 10-12 programming simple robots using pbForth. The caught on quickly and were very pleased with themselves at the show-and-tell session with their parents.
University of Maine Computer Science
The UMCS Robotics Language Research Group has put together a survey of programming environments for the RCX. One of the reports was on pbForth and I have taken many of the recommendations from it into consideration.