[HomePage] [TitleIndex] [WordIndex

Lego Mindstorms

A page of info, ideas and activities using Lego Mindstorms stuff.

pbForth

pbForth is a version of the Forth language adapted for the Lego RCX "brick" controller by Ralph Hempel (http://www.hempeldesigngroup.com/lego/pbForth/homePage.html). Forth (as a language) is perfect for the RCX because of its speed and small program size. Machine control is one of the language's most common application areas. pbForth unlocks many additional features and storage in the RCX that is not available in the bundled Lego programming software. But you have to be a real computer nerd to use it, because Forth has an unusual (but extremely powerful and clean) syntax based on a data-stack (i.e. like a HP calculator).

Unfortunately, it appears that pbForth is no longer actively maintained, developed or discussed. Never-the-less, it can be used in its already well-developed state. Some of the information here is intended to document what is required to get it going and use it effectively, and to act as a repository of useful files, should the official pbForth site shut down. All you need to know about pbForth to get you going is on the pbForth page.

Projects

Weblog

PeterMills   StickBalancer
Project has started.  A first cart has been constructed and programmed with a simple control algorithm.  As expected, the simple control did not successfully balance the stick.  See the StickBalancer page for details.
2007-05-20 18:15:27
PeterMills   pbForth Page
Started adding content to the pbForth page so that its documented before I forget the steps I needed to go through to get things working.
2007-04-18 15:23:52
PeterMills   BOS
Whoops, looks like BOS has a bug which causes it to freeze if its been sleeping for a long time!  Something in RAM might be forgotten.  For now, back to the simpler BOS which doesn't try to concurrently run the interpreter and the BOS - just one or the other.
2007-04-08 22:31:03
PeterMills   pbForth Button Operating System (BOS)

BOS can now be left in the RCX and only the user-program need be downloaded.  Previously, the user-program needed to be embedded in the BOS code and so the whole source (BOS + user-program) needed to be downloaded.  This meant more difficult to edit large source files, as well as longer downloads.  The new program_template.f still has a small amount of code around the user parts to automatically clear the old user-program and to register (using ') the "init" and "scan" words with BOS for execution.

The second change to BOS is that it now uses the 'UserIdle loop of the console interpreter, so the program runs concurrently with the console interaction.  This is temporarily disabled while downloading a new program, so that execution of an idle BOS doesn't interfere with fast console input during downloading.  So the escape button pair of Prgm and View, used to stop the program and revert to console, is no longer required and can be removed (todo).
2007-04-02 18:07:30
PeterMills   StickBalancer - other measurements required!
Although we have an angle sensor, and a sort-of cart speed sensor (assuming the cart speed is related to motor power??), but we need the cart to return to its original position (approximately), so we need a cart position sensor.  Perhaps the best way is to put the light sensor up close to the holes in a gear wheel connected to the wheels, and count holes or spokes.  We would need to combine this with the direction of movement (just use the motor drive direction?) so that we can count distance forward and backward.  It might miss a few counts as the motors try to change direction, but should be good enough for this exercise.
2007-04-02 13:43:39
PeterMills   pbForth Button Operating System
Completed a good execution-vector-based Button "Operating System" for the RCX to allow it to be run/stopped, powered up/down, and escape to the interactive mode, while leaving the individual Prgm and View keys available for the program itself.  This will be used in the StickBalancing project.
2007-04-02 11:48:39
PeterMills   StickBalancer Angle Sensor
Just completed coding word definitions to convert a homebrew potentiometer sensor into rotation angle.  Thanks to Michael Gasperi (www.extremenxt.com/lego.htm) for his homebrew sensor site.  I needed to code some of the calculations specifically to reduce truncation/precision errors etc (using */).
2007-04-02 11:45:28

2015-05-14 10:30