BASIC stamp manual v2.2

5: BASIC Stamp Command Reference – CONFIGPIN
BASIC Stamp Syntax and Reference Manual 2.2 www.parallax.com Page 145
The logic threshold for TTL is 1.4 volts; a voltage below 1.4 is considered
to be a logic 0 while a voltage above 1.4 is considered to be a logic 1. The
logic threshold for CMOS is 50% of Vdd; a voltage below ½ Vdd is
considered a logic 0 while a voltage above ½ Vdd is considered a logic 1.
For the CONFIGPIN command’s THRESHOLD mode, a high bit (1) in the
PinMask argument sets the corresponding I/O pin to CMOS threshold
level, and a low bit sets it to a TTL threshold level. The following example
sets CMOS threshold level on I/O pins 3, 2, 1, and 0, and TTL threshold
level on all other I/O pins.
CONFIGPIN THRESHOLD, %0000000000001111
The threshold level can be set for all pins, regardless of pin direction, but
really matters only when the associated pin is set to input mode.
Normally, if a signal on an input pin is somewhat noisy (the voltage level
randomly rises and falls beyond the logic threshold boundary) then
reading that pin’s input value will result in spurious highs and lows (1s
and 0s). Schmitt Triggers are circuits that make inputs more steady and
reliable by adding a region of hysteresis around the logic threshold that
the signal must completely traverse before the logic level is interpreted as
being changed. By default BASIC Stamp I/O pins are set to normal input
mode, but the BS2px can be configured for Schmitt Trigger mode as well.
Figure 5.3 illustrates Schmitt Trigger characteristics.
Figure 5.3: Schmitt Trigger
Characteristics
In Schmitt Trigger mode, the threshold for a logic 0 is approximately 15%
of Vdd and the threshold for a logic 1 is approximately 85% of Vdd. The
input pin defaults to an unknown state until the initial voltage crosses a
logic 0 or logic 1 boundary. Thereafter, the voltage must cross above 85%
of Vdd to be interpreted as a logic 1 and must cross below 15% of Vdd to
be interpreted as a logic 0. If the voltage transitions somewhere between
the two thresholds, the interpreted logic state remains the same as the
previous state.
SCHMITT TRIGGER