View Full Version : converting input pins to a decimal number?

02-01-2007, 02:40 AM
hey, im new to the basic stamp.I have an A/D converter andI am trying to find a way to convert a string of high and low signals (P0-P7) into a decimal number. Can any1 help me out with this? Thanks in advance.

02-01-2007, 02:50 AM
What A/D converter are you using ?

By (P0-P7) do you mean the 8 signals are on pin 0 thru pin 7 (using 8 pin of the basic stamp) ?


Cheap used 4-digit LED display with driver ICwww.hc4led.com (http://www.hc4led.com)

Low power SD Data Logger www.sddatalogger.com (http://www.sddatalogger.com)
SX-Video Display Modules www.sxvm.com (http://www.sxvm.com)
Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1

"USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman

02-01-2007, 02:56 AM
Hi grkblood13, if your using P0 to P7 then

value var byte


debug DEC value

Jeff T.

02-01-2007, 04:58 AM
hey, thanks for the help. you made that too easy. i might have some other questions along the way.

02-20-2007, 11:10 PM
hey, i was just wondering what i would need to do to make it (po-p8) other than using the INS command. i want more accurate results so im thinking about going up one more bit but i am also using other pins for other things so i cant use the INS command b/c the other pins will throw the reading off.

02-20-2007, 11:32 PM

MyWord = INS & $01FF ' This 'masks' off the 'don't care' bits

' Note any pins set for 'input' or 'output' will remain set that way.
' Any pin set for output will return the value last sent to the 'output latch',
' but you mask that value off as a 'don't care'.
' But reading that bit won't affect its input/output state, or its value, so
' you can do that without having a 'bad effect'.