Quote:
Originally posted by rosebud
then why did my other programs work? on the operator interface, aren't all the pins connected? how else can information from the joysticks and everything else be used? isnt the debug program supposed to have names for all the pins so we can use them? id appreciate a more detailed explanation cause im still kinda confused.
also, i have another question not really connected. how different are the analog inputs treated than the digital. my point: if i run out of digital inputs, could i make the computer pretend the analog inputs are digital? so i could use more sensors and limit swtiches.
thanks
|
It's a complex issue, but here's a quick explanation of why you can't use BUTTON:
The BASIC Stamp that we use (the 2sx) is designed for a whole lot more than just the robot contollers. In other applications, EE guys will connect a switch directly between ground, +5V and a pin on the Stamp.
This is the intention of the BUTTON command. The InnovationFirst controllers, however, do not work this way. All of the switches, analogs, etc, are connected to a separate uP inside the RC. How exactly they are connected is not documented, but it doesn't really matter. What matters is that this separate uP processes all the inputs from both the OI and the RC. This uP then connects to the Stamp via a standard RS-232 signal over one of the pins. This is where the Serin/Serout comes from.
The only things directly connected to the Stamp that you should EVER touch are pins 7-15. Pin 7 is the basic run LED, and 8-15 are the various other LEDs you can control. Everything else comes in mass through the serin command and becomes individual bits in variables instead of actual pins.
As for using an analog for a digital switch, you can definately do it. Two years ago, we ran out of switches on the OI, so I wired a little toggle switch between +5V and one of the analog ins. There was also an LED in series with it, but that doesn't matter. When the switch is off, the analog will read 127. When it is on, it will read something else. What that something else is depends on the amount of resistance in your circuit. In my case the LED caused us to get a value of 160-ish when on and 127 when off.