' 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, " 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, " | | | | ", CR, "---- ---- ---- ---- " Main: DO ' Display input pin states DEBUG CRSRXY, 0, 12 , BIN4 IND, " ", BIN4 INC, " ", BIN4 INB, " ", BIN4 INA LOOP
BASIC Stamp Help Version 2.5.4
Copyright © Parallax Inc.
8/8/2012