View Full Version : converting input pins to a decimal number?
02-01-2007, 03:40 AM
hey, im new to the basic stamp.·I have an A/D converter and·I 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.
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 IC·www.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, 03:56 AM
Hi grkblood13, if your using P0 to P7 then
value var byte
debug DEC value
02-01-2007, 05:58 AM
hey, thanks for the help. you made that too easy. i might have some other questions along the way.
02-21-2007, 12:10 AM
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-21-2007, 12:32 AM
MyWord VAR WORD
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'.