Rotary switch and basic stamp, managing 8 outputs with less pins used, possible?
CuriousOne
Posts: 931
Hello.
I have a task. There's a rotary switch for 8 positions, that connects to apropriate pins of basic stamp. There are also 8 outputs.
When I set switch to position #1 - signal is high on output 1. When I set to position #2 - signal is high on outputs 1 & 2, when I set to position #3 - signal is high on outputs 1, 2, & 3. And so on, till 8.
Of course, I can do this all in software and it's quite easy. But, it consumes a lot of IO pins, which I'd like to use for other purposes. So, maybe there's some simple additional hardware available, which will handle these outputs and inputs, freeing IO pins. Usage of rotary encoder not possible, due to specific requirements (device may be switched off, switch set to arbitrary position and then powered on, so ouput should correspond to switch setting).
Also, I can do it with diode matrix, without using basic stamp at all, but I don't think that to be the elegant solution.
I have a task. There's a rotary switch for 8 positions, that connects to apropriate pins of basic stamp. There are also 8 outputs.
When I set switch to position #1 - signal is high on output 1. When I set to position #2 - signal is high on outputs 1 & 2, when I set to position #3 - signal is high on outputs 1, 2, & 3. And so on, till 8.
Of course, I can do this all in software and it's quite easy. But, it consumes a lot of IO pins, which I'd like to use for other purposes. So, maybe there's some simple additional hardware available, which will handle these outputs and inputs, freeing IO pins. Usage of rotary encoder not possible, due to specific requirements (device may be switched off, switch set to arbitrary position and then powered on, so ouput should correspond to switch setting).
Also, I can do it with diode matrix, without using basic stamp at all, but I don't think that to be the elegant solution.
Comments
Also there are i/o multiplexers that operate on an i2c buss, and are configurable as either inputs or outputs. For example, NXP (Philips) PCA9535. That is easiest to implement on the BS2p series with built-in I2C commands.