BASIC stamp manual v2.2

5: BASIC Stamp Command Reference – CONFIGPIN
BASIC Stamp Syntax and Reference Manual 2.2 www.parallax.com Page 143
CONFIGPIN
BS1 BS2 BS2e BS2sx BS2p BS2pe BS2px
CONFIGPIN Mode, PinMask
Function
Configure special properties of I/O pins.
Mode is a variable/constant/expression (0 – 3), or one of four
predefined symbols, that specifies the I/O pin property to configure:
Schmitt Trigger, Logic Threshold, Pull-up Resistor or Output
Direction. See Table 5.5 for an explanation of Mode values.
PinMask is a variable/constant/expression (1 – 65535) that indicates
how Mode is applied to I/O pins. Each bit of PinMask corresponds
to an individual I/O pin. A high bit (1) enables the Mode and a low
bit (0) disables the Mode on the corresponding I/O pin.
Quick Facts
Table 5.5: CONFIGPIN Quick
Facts.
BS2px
0 (or SCHMITT): Schmitt Trigger
1 (or THRESHOLD): Logic Threshold
2 (or PULLUP): Pull-up Resistor
Mode Values
3 (or DIRECTION): Output Direction
Related Commands
(For DIRECTION Mode)
INPUT and OUTPUT, and the DIRx = # assignment statement
Explanation
The CONFIGPIN command enables or disables special I/O pin properties
on all 16 I/O pins at once. There are four properties, or modes, available:
Schmitt Trigger, Logic Threshold, Pull-up Resistor, and Output Direction.
Each I/O pin on the BS2px contains special hardware dedicated to each of
these properties.
By default, all BASIC Stamp I/O pins are set to inputs. Enabling the
Output Direction mode sets an I/O pin’s direction to output. Disabling
the Output Direction mode sets an I/O pin’s direction to input. This has
the same effect as using the OUTPUT or INPUT commands, or the
DIRx = # assignment statement to configure I/O pin directions. The
following is an example of the CONFIGPIN command using the Output
Direction mode:
CONFIGPIN DIRECTION, %0000000100010011
OUTPUT DIRECTION.