Est. 1992 Beginner

PBASIC

A compact, microcontroller-oriented dialect of BASIC created by Parallax for its BASIC Stamp modules, designed to make programming embedded hardware approachable for hobbyists, students, and engineers.

Created by Parallax, Inc.

Paradigm Procedural; embedded/microcontroller scripting
Typing Static, weak; integer-only sizes (Bit, Nib, Byte, Word) with no floating-point type
First Appeared 1992 (with the original BASIC Stamp 1)
Latest Version PBASIC 2.5 (2003)

PBASIC is a compact dialect of BASIC created by Parallax, Inc. to program its BASIC Stamp microcontroller modules. It is not a general-purpose language meant for desktop applications; it is a small, hardware-aware scripting language whose entire reason for being is to make controlling pins, motors, sensors, and serial peripherals approachable for people who are not professional embedded engineers. For much of the 1990s and 2000s — well before the Arduino popularized accessible microcontrollers — PBASIC running on a BASIC Stamp was, for countless students and hobbyists, their first encounter with making hardware do something under program control.

History & Origins

Parallax was founded in the late 1980s by Chip Gracey (with co-founder Lance Walley, according to the company’s own history), and in 1992 the company introduced the original BASIC Stamp 1 (BS1) along with PBASIC 1.0. The module earned its name from its small footprint — roughly the size of a postage stamp — and its appeal from a simple promise: you could write a few lines of BASIC, download them over a cable, and have a real circuit respond.

The breakthrough product was the BASIC Stamp 2 (BS2-IC), released in 1995 and built around a Microchip PIC16C57 microcontroller. The BS2 came with a considerably richer PBASIC and became the line’s flagship; it is the variant most people mean when they refer to “the BASIC Stamp.” Over the following years Parallax broadened the family with sub-variants — BS2e, BS2sx, BS2p, BS2pe, and BS2px — each adding some combination of more memory, faster execution, additional I/O pins, and extra specialized PBASIC commands, with several later models using the Parallax SX processor.

Adoption grew quickly. Parallax reported more than 200,000 modules in use by mid-2000 and over three million BASIC Stamps in use by 2002. In 2003, PBASIC 2.5 added structured-programming constructs that modernized the language and made larger programs easier to maintain.

Design Philosophy

PBASIC is built around accessibility and tight integration with hardware rather than generality or performance:

  • Hardware-first vocabulary. Alongside the familiar BASIC repertoire, PBASIC provides commands that map directly onto microcontroller tasks — HIGH and LOW to set pins, PULSOUT to emit timed pulses, FREQOUT to generate tones, PWM, SEROUT/SERIN for serial communication, and DEBUG to print values back to the PC.
  • Small and deterministic. The language deliberately avoids the heavyweight machinery of general-purpose languages so it can run on extremely modest hardware with only a few dozen bytes of variable RAM.
  • Beginner-friendly. Programs are short, readable, and tolerant; a newcomer can blink an LED or read a sensor in a handful of lines.

How It Runs

PBASIC’s execution model is distinctive. Programs are not compiled to native machine code. Instead, the BASIC Stamp Editor (a Windows IDE) tokenizes the source on the PC and downloads the tokens into the module’s serial EEPROM. On the BS2, that EEPROM is 2 KB and holds the tokenized program; a small on-chip firmware interpreter then reads and executes those tokens at run time.

To pack programs into limited EEPROM, the tokens are stored efficiently — described as Huffman-compressed, non-byte-aligned, variable-length tokens. This interpreted, tokenized approach is the reason PBASIC is easy to use but comparatively slow: on the BS2, the interpreter executes on the order of a few thousand PBASIC instructions per second (commonly cited as roughly 4,000 per second on the PIC16C57-based BS2), a figure that is more than adequate for blinking LEDs, reading sensors, and driving hobby servos, but far below what a compiled program on the same chip could achieve. Performance varies across the BS2 variants, with the faster SX-based models running noticeably quicker.

Key Features

  • Integer-only, sized variables. PBASIC variables are declared with explicit sizes — Bit, Nib (nibble), Byte, and Word (16-bit) — and there is no built-in floating-point type. Arithmetic is unsigned integer math.
  • Constants and program structure. Variables and constants are typically declared at the top of a program; later PBASIC (2.5) added structured constructs such as DO...LOOP, FOR...NEXT, SELECT...CASE, and IF...THEN...ELSE...ENDIF.
  • Direct pin and timing control. Built-in commands address the I/O pins and on-board timing directly, which is what makes PBASIC feel purpose-built for electronics.
  • DEBUG for visibility. The DEBUG command sends text and values back over the programming cable to a terminal window, serving as PBASIC’s primary debugging and teaching aid.
  • Apostrophe comments. As in classic BASIC dialects, comments begin with an apostrophe (').

A flavour of the syntax

' Blink an LED on pin 0 forever (PBASIC 2.5 style)
counter VAR Byte

Main:
  DO
    HIGH 0              ' turn the LED on
    PAUSE 500           ' wait 500 ms
    LOW 0               ' turn the LED off
    PAUSE 500
    counter = counter + 1
    DEBUG "Blinks: ", DEC counter, CR
  LOOP

Evolution

PBASIC moved from the original BS1’s PBASIC 1.0 to the richer 2.x language that shipped with the BASIC Stamp 2, and finally to PBASIC 2.5 in 2003, which introduced the structured-programming features that bring it closer to how modern BASIC dialects are written. Rather than evolving into a sprawling language, PBASIC’s growth came largely through the expanding set of hardware-specific commands tied to successive BASIC Stamp models. The BASIC Stamp Editor IDE has continued to receive updates to support newer operating systems and connection methods (RS-232 and later USB).

Current Relevance

PBASIC occupies a transitional place in the history of accessible embedded computing. It demonstrated, years before the Arduino, that ordinary people could meaningfully program hardware, and it became a staple of electronics education. Parallax has since introduced more capable platforms — notably the multi-core Propeller (programmed in Spin) and microcontrollers programmable in C — yet the company has continued to sell and support BASIC Stamp modules and PBASIC, and the language remains a fixture in many classrooms and hobbyist toolkits. Its lineage also lives on indirectly: the PICAXE system, for example, uses a BASIC closely related to the one used on the original BASIC Stamp.

Why It Matters

PBASIC’s significance is less about technical sophistication than about democratization. By pairing a friendly, hardware-aware BASIC with an inexpensive, breadboard-friendly module and a one-click download workflow, Parallax lowered the barrier to physical computing for a generation of learners. The patterns it popularized — simple I/O commands, a tokenized download-and-run cycle, and a DEBUG-driven feedback loop — anticipated the accessible-microcontroller movement that platforms like Arduino later carried to a mass audience. For that reason, PBASIC is best remembered as a foundational on-ramp into embedded programming.

Timeline

1992
Parallax, Inc. introduces the first BASIC Stamp module and PBASIC 1.0, a microcontroller-oriented dialect of BASIC. The module is named for its small, postage-stamp-like size.
1995
Parallax releases the BASIC Stamp 2 (BS2-IC), built around a Microchip PIC16C57 microcontroller. It ships with substantially enhanced PBASIC (the 2.x line) and becomes the most widely used member of the family.
Late 1990s - early 2000s
Parallax expands the line with BS2 sub-variants (BS2e, BS2sx, BS2p, BS2pe, BS2px) offering more memory, faster execution, additional I/O pins, and extra specialized PBASIC commands; several later variants use the Parallax SX processor.
2000
By July 2000, Parallax reports that customers have put more than 200,000 BASIC Stamp modules into use, reflecting strong adoption in education and hobbyist electronics.
2002
Parallax reports more than three million BASIC Stamp microcontrollers in use worldwide, cementing PBASIC's role as a common first language for physical computing.
2003
PBASIC 2.5 is released, adding structured-programming constructs (such as DO...LOOP, SELECT...CASE, and IF...THEN...ELSE...ENDIF) that make programs easier to read and maintain for students and engineers.
2010s-2020s
Parallax continues to sell and support BASIC Stamp modules and the BASIC Stamp Editor IDE, keeping PBASIC available even as newer Parallax platforms (Propeller/Spin, microcontrollers programmable in C) emerged.

Notable Uses & Legacy

Education and classrooms

PBASIC and the BASIC Stamp underpin Parallax's long-running educational curricula, such as the "What's a Microcontroller?" course, and much early research into physical-computing instruction used BASIC Stamp hardware.

Boe-Bot robotics platform

Parallax's Boe-Bot, a small wheeled robot widely used in schools and universities, is programmed in PBASIC, teaching sensors, motor control, and timing through simple commands.

Hobbyist and maker electronics

Before low-cost boards like Arduino became common, the BASIC Stamp let hobbyists prototype embedded projects quickly using PBASIC's hardware-aware commands such as HIGH, LOW, PULSOUT, and FREQOUT.

Rapid prototyping and instrumentation

Engineers and tinkerers used BASIC Stamps with PBASIC for quick control, sensing, and data-logging tasks where ease of programming mattered more than raw performance.

Language Influence

Influenced By

Influenced

PICAXE BASIC

Running Today

Run examples using the official Docker image:

docker pull
Last updated: