PDA

View Full Version : Defective or Working BASIC Stamp



Fwiss
02-01-2010, 10:46 PM
I was using the Board of Education, (So I don't know if this is the right place to post) and used the following code to see how it got input:s
' {$STAMP BS2}
' {$PBASIC 2.5}

DO
DEBUG CRSRXY, 0, 3,
BIN1 IN6, BIN1 IN5, BIN1 IN7, BIN1 IN4
PAUSE 100
LOOP

(Just something I got from the BOE-Bot Book)

I had nothing plugged in, and sometimes it gave 1101, others it gave 1111 another 0000, but nothing plugged in. When I removed it from the wooden table, (It had rubber legs so it didn't even contact the table) The voltage input data changed. Is this defective or normal?

allanlane5
02-01-2010, 10:56 PM
If you have nothing tied to an input pin, and then read that input pin, it acts like an antenna. Usually, it picks up the 60Hz 'noise' from power lines. So yes, this is normal.

This is why people use 10K ohm pull-up, (or pull-down) resistors to give a definite 'default' value on input pins, even when the driver is disconnected. I say "driver", because USUALLY when you're reading an input pin, you expect it to be 'driven' by some driver output somewhere -- otherwise you wouldn't be reading it.

Fwiss
02-01-2010, 11:28 PM
Good, so it's not messed up! Thanks, that was very helpful.