Our Hobby

The Fantastic Hobby

Microcontroller With Interpreter and Extra Goodies

3 min read
Microcontroller With Interpreter and Extra Goodies

The BASIC Stamp is, at the heart, a microcontroller with interpreter software built in. These devices also come with additional support circuitry, such as an EEPROM, voltage regulator, ceramic oscillator, etc. BASIC Stamps are ideal for beginners because they are easy to program, quite powerful, and relatively cheap-a whole startup package costs around $150 dollars or so. These devices are also very popular among inventors and hobbyist, and you’ll find a lot of helpful literature, application notes, and fully tested projects on the Internet. The original stamp was introduced in 1993 by Parallax, Inc. It got its name from the fact that it resembled a postage stamp.

The early version of the BASIC Stamp was the REV D, while later improvements lead to the BASIC Stamp I (BSI) and to the BASIC Stamp II (BSII). Here we’ll focus mainly on the BSI and the BSII. Both the BSI and BSII have a specially tailored BASIC interpreter firmware built into the microelectronics EPROM. For both stamps, a PIC micro controller is used. The actual program that is to be run is stored in an on board EEPROM. When the battery is connected, stamps run the BASIC program in memory. Stamps can be reprogrammed at any time by temporarily connecting them to a PC running a simple host program. The new program is typed in, a key is hit, and the program is loaded into the stamp. Input/output pins can be connected with other digital devices such as sense switches, LED, LCD displays, servos, stepper motors, etc.


The BSII is a module that comes in a 28-pin DIL package. The brain of the BSII is the PIC16C57 micro controller that is permanently programmed with a PBASIC2 instruction set within its internal OTP-EPROM (one-time program ROM). When programming the BSII, you tell the PIC16C57 to store symbols, called tokens, in external EEPROM memory. When the program runs, the PIC16C57 retrieves tokens from memory, interprets them as PBASIC2 instructions, and carries out those instructions. The PIC16C57 can execute its internal program at a rate of 5 million machine instruction per second. However, each PBASIC2 instruction takes up many machine instructions, so the PBASIC2 executes more slowly, around 3000 to 4000 instructions per second.

The BSII comes with 16 I/O pins (P0-P15) that are available for general use by your programs. These pins can be interfaced with all modern 5-V logic, from TTL through CMOS (technically, they have characteristics like the 74HCT logic series). The direction of a pin-either input or output-is set during the programming phase. When a pin is set as an output pin, the BSII can send signal to other devices, like LEDs, servos, etc. When a pin is set as an input pin, it can receive signals from external devices, such as switches, photosensors, etc. Each I/O pin can source 20 mA and sink 25 mA. Pins P0-P7 and pins P8-P15, as groups, can each source a total of 40 and sink 50 mA.

2048-Byte EEPROM

The BSII’s PIC’s internal OTP-EPROM (one-time programmable read-only memory) is permanently programmed at the factory with Parallax’s firmware which turns this memory into a PBASIC2 interpreter chip. Because they are interpreters, the Stamp PICs have the entire PBASIC language permanently programmed into their internal program memory. This memory cannot be used to store your PBASIC2 program. Instead, the main program must be stored in the EEPROM (electrically erasable, programmable read-only memory).

This memory retains data without power and can be reprogrammed easily. At run time, the PBASIC2 program created on the host computer is loaded into the BSII’s EEPROM starting at the highest address (2047) and working downward. Most programs do not use the entire EEPROM, which means that PBASIC2 lets you store data in the unused lower portion of the EEPROM. Since programs are stored from the top of the memory downward, data are stored in the bottom of the memory working upward.

The author also write articles on ” Innovative Electronics Ideas”



denitomiadv.com © All rights reserved. | Newsphere by AF themes.