Specifications

BASIC Stamp II
Page 208 • BASIC Stamp Programming Manual 1.8 • Parallax, Inc.
PBASIC2 Interpreter Chip (U1)
The brain of the BS2 is a custom PIC16C57 microcontroller (U1). U1 is
permanently programmed with the PBASIC2 instruction set. When you
program the BS2, you are telling U1 to store symbols, called tokens, in
EEPROM memory (U2). When your program runs, U1 retrieves to-
kens from memory (U2), interprets them as PBASIC2 instructions, and
carries out those instructions.
U1 executes its internal program at 5 million instructions per second.
Many internal instructions go into a single PBASIC2 instruction, so
PBASIC2 executes more slowly—approximately 3000 to 4000 instruc-
tions per second.
The PIC16C57 controller has 20 input/output (I/O) pins; in the BS2
circuit, 16 of these are available for general use by your programs. Two
others may also be used for serial communication. The remaining two
are used solely for interfacing with the EEPROM and may not be used
for anything else.
The general-purpose I/O pins, P0 through P15, can interface with all
modern 5-volt logic, from TTL (transistor-transistor logic) through
CMOS (complementary metal-oxide semiconductor). To get technical,
their properties are very similar to those of 74HCTxxx-series logic de-
vices.
The direction—input or output—of a given pin is entirely under the
control of your program. When a pin is an input, it has very little effect
on circuits connected to it, with less than 1 microampere (µA) of cur-
rent leaking in or out. You may be familiar with other terms for input
mode like tristate, high-impedance, or hi-Z.
There are two purposes for putting a pin into input mode: (1) To pas-
sively read the state (1 or 0) of the pin as set by external circuitry, or (2)
To disconnect the output drivers from the pin. For lowest current draw,
inputs should always be as close to +5V or ground as possible. They
should not be allowed to float. Unused pins that are not connected to
circuitry should be set to output.