I've seen other small microcontroller development systems besides the Basic Stamp from Parallax. Blue Earth Micro, for example, sells a device that connects to your PC's serial port and looks no bigger than an RS-232 gender-changer, yet it includes an 8051 with 32 KB of RAM and a BASIC interpreter on-board. But even these features can't compete with the elegant simplicity of the Basic Stamp (see the photo).
The Basic Stamp is a surprisingly small, yet surprisingly complete, PIC 16C56 development system. It consists of two--that's right, two--ICs, a 4-MHz resonator (i.e., an oscillator circuit), a voltage regulator, and a handful--not even a thimbleful, actually--of passive electronics. The whole thing can be powered by a 9-V transistor battery (you can see the battery clip in the photo).
A three-pin header connect
s the Basic Stamp to your PC's printer port via a cable supplied by Parallax. Parallax also supplies development software that allows you to program the Basic Stamp in a trimmed-down version of BASIC.
Measuring 1 1/2 by 2 1/2 inches, the Basic Stamp is not much bigger than a Matchbox car. When you consider that at least half of the board's surface area is prototyping area, the Basic Stamp becomes even more amazing.
The board's larger chip is the PIC 16C56 processor. Parallax has programmed it with a run-time kernel that executes the tokenized BASIC program that you create using the development software mentioned above. The code on the PIC 16C56 also contains all the routines necessary to download the program from your PC onto the board's other chip--a 256-byte serial EEPROM. Eight of the PIC processor's pins are available as I/O from a header strip that lies adjacent to the prototyping space.
The Basic Stamp's dialect of BASIC is limited but capable. Obviously, mathematical expressions ar
e restricted to integers, and expression evaluation proceeds from left to right. Multiplication and division are a little strange in that there are separate operations for returning the high word and the low word of the result. Also, programs have access to only seven general-purpose variables.
Nevertheless, you can use LET statements, GOSUB...RETURN statements, IF...THEN statements, and FOR...NEXT statements. Furthermore, the language's designers have added numerous special functions that are useful for--or even critical to--embedded applications builders.
For example, the BUTTON function reads the state of a switch on an input pin, handles debouncing automatically, and lets you specify an auto-repeat delay and rate (if the button is held down). The PULSIN function reads the duration of a pulse on one of the PIC's I/O pins, accurate to 10 microseconds. The PWM function will output a pulse-width modulation on one of the processor's output pins. With the SERIN and SEROUT functions, you can specif
y pins as serial inputs and/or outputs and transmit or receive characters at speeds of up to 2400 bps.
By anyone's standards, the Basic Stamp is quite an accomplishment of both hardware and software engineering. Documentation from Parallax suggests that it's possible to get, on average, about 80 lines of BASIC on a Basic Stamp. And since your code is being programmed into an EEPROM each time you download it, it's quite reasonable for you to simply take your development system and attach it directly to whatever target it will be controlling.
Personally, I'd love to get a chance to look at the source to the code in the PIC 16C56. Parallax managed to cram all the run-time capabilities of the functions described earlier--the BASIC control statements; digital and analog I/O handling; serial ports; and even the code to communicate with the PC, download the tokenized program into the EEPROM, and execute the tokens--into 512 12-bit instructions. If I were to achieve a similar programming feat, I would d
ie a happy man.