June, 2002
The "BASIC Stamp" is a self-contained computer that can be
programmed using the BASIC (PBASIC) programming language,
and the entire computer is about the size of a postage stamp,
hence the name.
BASIC Stamp computers are manufactured by Parallax, Inc.
Parallax, Inc. WWW Site
Each Stamp computer is actually a tiny circuit board, with
pins to allow the board to be plugged in to sockets like
conventional microchips.
There is a family of BASIC Stamp computers: 1, 2, 2E, 2SX, 2P,
etc, differing in physical size and capabilities.

FIGURE: BASIC Stamp 1 (Note the PIC16C56 chip)

FIGURE: BASIC Stamp 2 (Note the PIC16C57 chip)
The core of each Stamp computer is a microcontroller ("PIC16C5x")
manufactured by Microchip Technology, Inc.
Microchip Technology, Inc. WWW Site
(Follow: "Products" --> "Micro. By Family" --> "PIC16 Micro. Family")
Here is a link to the data sheet for the "PIC16C57C" microcontroller,
which is the core of the "BASIC Stamp 2" circuit board.
PIC16C57C Data Sheets (WWW site)
Here's a link to a local copy of the PIC16C5X Data Sheet
(which includes data for the "PIC16C57C" microcontroller):
PIC16C5X Data Sheet (PDF) [WARNING: 2.7MB]

FIGURE: The PIC16C57 chip signals (from data sheet).

FIGURE: The PIC16C57 chip instruction set (from data sheet).
Note that the PIC16C5X (e.g., PIC16C57C) instruction set
is essentially assembly language, NOT the BASIC (PBASIC)
programming language.
I am pretty sure that the PBASIC compiler converts your
PBASIC code in to the microcontroller's assembly language.
(But I am not certain.)
Here are some specifications for the "BASIC Stamp 2"
circuit board computer:
================================================================
BASIC Stamp 2 - SPECIFICATIONS
================================================================
CORE: PIC16C57C (manufacturer: "Microchip Technology, Inc.")
-------------------------------------------------------------
RAM: 72 Bytes
EEPROM: 2048 Bytes
SPEED: 40 MHz (max)
I/O: 20 TTL Inputs/Outputs (configurable)
POWER: 5 VDC
BOARD / PBASIC INTERFACE:
-------------------------
POWER: 5 VDC
RAM: 32 Bytes (26 bytes user variables, 6 bytes I/O variables)
EEPROM: ~600 PBASIC instructions capacity
SPEED: ~4000 PBASIC instructions per second
SERIAL: 9600 baud typical (up to 100kbaud)
================================================================
Note that the "PIC16C57C" chip contains the RAM, EEPROM, I/O
lines, and Serial I/O port implementation. The "BASIC Stamp 2"
board provides very simple electrical support to the microcontroller.
Although the "PIC16C57C" chip works in terms of 33 assembly
language instructions, and can operate at a clock speed of 40 MHz,
all of that is hidden from us when we use the "BASIC Stamp 2"
software in conjunction with the board.
The Parallax, Inc. "Board of Education" Project Board:
======================================================
Parallax, Inc. manufactures a product called the "Board of
Education", which is a convenient way to experiment with
their "BASIC Stamp 2" product.

FIGURE: Parallax, Inc. "Board of Education" project board.
(NOTE: The "BASIC Stamp 2" is not installed.)

FIGURE: Parallax, Inc. "Board of Education" project board.
(NOTE: The "BASIC Stamp 2" is installed in the socket.)
My First Experience with the "BASIC Stamp 2" product:
=====================================================
I purchased the "BASIC Stamp 2" and the "Board of Education"
bundled together in a product called "BOE-BOT ROBOT FULL KIT",
produced by Parallax, Inc.
This kit cost $199.99 at Fry's Electronics. The kit contains:
(1) "BASIC Stamp 2" module; (2) "Board of Education" board;
(3) RS-232 cable; (4) Software CD-ROM; (5) Simple robot
parts (2 servo motors, LED's, piezo speaker, robot chassis,
robot wheels, transistors, resistors, capacitors);
(6) BASIC Stamp programming manual; (7) BOE-Robot construction
manual.
I bought the kit spontaneously because I've had a long
fascination with embedded computers, and this kit
had EVERYTHING needed to start playing around immediately.
I didn't really care about the "Robot" aspect of the
kit, and I figured that the cost of the Robot-specific
components wasn't a significant fraction of the price.
Even so, most of the "robot" parts can be used for the
generic experiments described in the BASIC Stamp
programming manual (and demo code on the CD-ROM).
I had demo code running on the BASIC Stamp 2 computer
in about 15 minutes! The hardest part was trying to
figure out the installation program on the CD-ROM,
and then waiting for the files to copy!
I plugged in the RS-232 cable to a serial port (COM1)
on my PC, put 4 AA-batteries in the battery pack,
plugged the "BASIC Stamp 2" module in to the socket
on the "Board of Education" board, launched the
PBASIC editor for windows, opened a demo program
file, and did "Control-R" to run...
A progress bar indicated the download of code to the
"BASIC Stamp 2" module via RS-232 (COM1). A moment
later the program was running!
Once a program is downloaded, you can disconnect
the RS-232 cable. Since the program is stored in
EEPROM (electrically erasable programmable memory),
you can turn off the power to the board, too.
When you turn the power back on, the program
starts execution! You can restart the program
with the reset button, too.
Here is a picture of my "Board of Education" board and
"BASIC Stamp 2" module, with power suppiled by a
battery pack.

FIGURE: My "Board of Education", with "BASIC Stamp 2", powered up.
Here is the entire PBASIC source code to play the
"Mary Had a Little Lamb" melody through a piezo speaker:
'========================================================================
'{$STAMP BS2} 'STAMP directive (specifies a BS2)
'------------------------------------------------------------------------
i VAR BYTE ' Counter for position in tune.
f VAR WORD ' Frequency of note for FREQOUT.
C CON 2092 ' C note
D CON 2348 ' D note
E CON 2636 ' E note
G CON 3136 ' G note
R CON 0 ' Silent pause (rest).
'------------------------------------------------------------------------
FOR i = 0 TO 28 ' Play the 29 notes of the LOOKUP table.
LOOKUP i,[E,D,C,D,E,E,E,R,D,D,D,R,E,G,G,R,E,D,C,D,E,E,E,E,D,D,E,D,C],f
FREQOUT 11,225,f,(f MIN 8) - 8
NEXT
STOP
'========================================================================
That's only 13 lines of PBASIC code (disregarding comment lines)!
Here's what it sounds like (recorded via microphone):
WAV Audio "Mary Had a Little Lamb" Melody.

FIGURE: My "Board of Education" board, "BASIC Stamp 2" module,
and battery pack.
This described my first experience with the "BASIC Stamp" computer
products. I will describe my interesting applications on another
WWW page.
--- Colin
cpfahey@earthlink.net