|
Test
Your EQ #154 Answer
|
Answer
8
Some simple adjustments of the resistor
values create equal-size voltage steps for the A/D converter
as shown below.
This gives 5 V when no switch
is pressed, and 0 to 3.75 V in approximately equal steps
when a switch is pressed. This approach works well for
up to 16 switches and beyond.
The general approach for
calculating the resistor values is as follows:
1. Select the pull-up resistor
value: 10 kilohms
2. Decide how many switches
are required: N = 16
3. The top switch generates
0 V by shorting the A/D input to ground
4. The next switch down
will generate VCC/ n V:
5. Select the nearest standard
5% value: 680 ohms
6. Repeat for switches i = 2 through N – 1
a.The next switch down will generate,
You must subtract the values
of the resistors above it
to helps avoid cumulative errors:
b. Select the nearest standard 5% value
For the specific example
of 16 switches, you should end up with the following resistor
values: 680, 750, 910, 1000, 1200, 1500, 1800, 2200, 2700,
3900, 5600, 7500, 13K, 27K, and 82K. Even with 5% resistors,
all of the resulting voltages are within 0.25% of full
scale of their nominal values.
Contributor: Dave Tweed
Published
May 2003