BASIC stamp manual v2.2
CONFIGPIN – BASIC Stamp Command Reference
Page 144 • BASIC Stamp Syntax and Reference Manual 2.2 • www.parallax.com
Every high bit (1) in the PinMask argument enables the output direction
for the corresponding I/O pin while every low bit (0) disables the output
direction. In the above example, I/O pins 8, 4, 1, and 0 are set to the
output direction and all other I/O pins are set to the input direction. This
is similar to the following statement:
DIRS = %0000000100010011
Pull-up resistors are commonly used in circuitry where a component, such
as a button, provides an open/drain signal; the signal is either floating
(open) or is driven to ground (drain). Since the BASIC Stamp input pins
must always be connected to either 5 volts or ground (0 volts) in order to
read a reliable logic state with them, a pull-up resistor is required on
circuitry, such as the button circuit mentioned above, so that the signal is
never left floating (electrically disconnected).
The following example enables internal pull-up resistors on I/O pins 15,
12, 6, and 3, and disables internal pull-up resistors on all other I/O pins:
CONFIGPIN PULLUP, %1001000001001000
Note that the internal pull-up resistors are intentionally weak, about 20
k. Additionally, the internal pull-up resistors can be activated for all
pins, regardless of pin direction, but really matter only when the
associated pin is set to input mode.
An input pin’s logic threshold determines the voltage levels that are
interpreted as logic high (1) and logic low (0). Most microcontrollers, and
other integrated circuits use one of two types of logic threshold: TTL Level
or CMOS Level. The BASIC Stamp I/O pins are, by default, configured
for TTL level logic thresholds. Figure 5.2 is an illustration of the difference
between TTL and CMOS logic levels.
TTL Logic Level CMOS Logic Level
Figure 5.2: TTL and CMOS Logic
Level Threshold Voltages
P
ULL-UP RESISTORS.
L
OGIC THRESHOLD.