View Single Post
  #6   Spotlight this post!  
Unread 02-04-2003, 09:17
seanwitte seanwitte is offline
Registered User
None #0116
Team Role: Engineer
 
Join Date: Nov 2002
Location: Herndon, VA
Posts: 378
seanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant future
Send a message via AIM to seanwitte
how many positions?

If you have room on the OI it would be eaiser to add a thumbwheel switch there, but here is how you can do what you're asking.

You will form a voltage divider for each output of the rotary switch. The voltage divider is two resistor in series, with one end pulled up to +5V and the other grounded. You take the output from the node between the two resistors.

Code:
^ +5
|
X
X R1
X
|--------------o Vout
X
X R2
X
|
- Ground
=
Vout = 5(R2/(R1 + R2)). So if you wanted it to be 2.5V you would use two resistors of the same value. To be consistent, the total resistance should be at least 100k ohms. You will have to figure out what the standard resistance values are, but heres how you could set up 9 discrete levels:

Code:
R1	R2	Vout
90k	10k	5(10/100) = 0.5V
80k	20k	5(20/100) = 1.0V
70k	30k	5(30/100) = 1.5V
60k	40k	5(40/100) = 2.0V
50k	50k	5(50/100) = 2.5V
40k	60k	5(60/100) = 3.0V
30k	70k	5(70/100) = 3.5V
20k	80k	5(80/100) = 4.0V
10k	90k	5(90/100) = 4.5V
You could also get some small 100k trim pots and tune them for each input. Then you would only need one per value instead of two resistors. They have a small screw that you turn so they shouldn't slip once set. All of this is way more trouble than its worth, try and work the switch into the OI if you can.

Last edited by seanwitte : 02-04-2003 at 09:29.