BASIC stamp manual v2.2
CONFIGPIN – BASIC Stamp Command Reference
Page 146 • BASIC Stamp Syntax and Reference Manual 2.2 • www.parallax.com
For the CONFIGPIN command’s SCHMITT mode, a high bit (1) in the
PinMask argument enables the Schmitt Trigger on the corresponding I/O
pin and a low bit (0) disables the Schmitt Trigger. The following example
sets Schmitt Triggers on I/O pins 7, 6, 5, and 4, and sets all other I/O pins
to normal mode.
CONFIGPIN SCHMITT, %0000000011110000
Schmitt Trigger mode can be activated for all pins, regardless of pin
direction, but really matters only when the associated pin is set to input
mode.
Demo Program (CONFIGPIN.bpx)
' CONFIGPIN.BPX
' This example demonstrates the use of the CONFIGPIN command.
' All I/O pins are set to inputs with various combinations of
' Pull-Up Resistor, Logic Threshold and Schmitt-Trigger properties.
' While running, this program will constantly display the state of all
' input pins along with an indication of the configuration for each group
' of pins. Try connecting different input signals to the I/O pins (such as
' buttons, a function generator with a slowing sweeping signal (0 to 5
' VDC)) or simply running your fingers across the I/O pins and note how
' they react based upon their configured property.
' {$STAMP BS2px}
' {$PBASIC 2.5}
#IF $STAMP <> BS2PX #THEN
#ERROR "This program requires a BS2px."
#ENDIF
Setup:
CONFIGPIN DIRECTION, %0000000000000000 'Set all I/O pins to inputs
CONFIGPIN PULLUP, %1111111111110000 'Enable pull-ups on pins 4 - 15
CONFIGPIN THRESHOLD, %0000111100000000 'Set P8-P11 to CMOS, others TTL
CONFIGPIN SCHMITT, %1111000000000000 'Enable Schmitt-Triggers P12-P15
DEBUG CLS
DEBUG " BS2px INPUT PIN CONFIGURATION TEST", CR,
"=========================================================", CR,
" P15-P12: Pull-Up Resistors, TTL & Schmitt-Triggers", CR,
" /", CR,
" / P11-P8: Pull-Up Resistors & CMOS", CR,
" / /", CR,
" | / P7-P4: Pull-Up Resistors & TTL", CR,
" | | /", CR,
" | | | P3-P0: Normal", CR,
" | | | /", CR,
NOTE: This example program can be
used only with the BS2px.