--_003_362766372BF84E1CA0C281795E9D6B63ivp3ghz_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable > Assign each switchable resistor > a binary weight and put this into a spreadsheet. Then start plugging > standard 1% resistor values into the spreadsheet to get the output > values. This will give you 16 distinct output voltages with all open > equal to zero As an exercise that was exactly what I'd done before posting. See the attached. '1' '2' '4' '8' could be 1k, 2k, 4k, 8k for example, or some multiple or fraction Below are the A/D results you could expect for closures from 0000 to 1111. View in fixed font I've not plotted them but the differences appear to be a geometric progression. The least difference, 15, is certainly able to be discriminated if resistance variations are minimised. I was looking for values of resistors that produced a more linear difference My plan would be to compare the A/D result with the calculated values, and then check for tolerance. A table is made, starting with 356 and ending with 1023. The table position of a match is the DIP setting in a second table, using the index from the first search For example, if the A/D result is 548, pull values from the table, starting with 356 and working up, and compare until the A/D result is less than the pulled value. Backing up one gives you the index for the second table 548 is between 545 and 584. Compare (548 - 545) and (584 - 548) to find the smaller difference, and assume the switch closure pattern is therefore (2 + 4 + 8), not (2 + 8) The second table is, represented in binary, 1111, 0111, 1011, 0011, 1101, 0101, 1001, 0001, 1110, 0110, 1010, 0010, 1100, 0100, 1000, 0000 ; All 124 128 12 148 14 18 1 248 24 28 2 48 4 8 None Closed ; ;0 =3D 1.000 Vdd =3D 1023 A/D ; ;1/1 =3D 1 =3D 0.500 =3D 511 ;1/1 + 1/2 =3D 1.5 =3D 0.400 =3D 409 ;1/1 + 1/4 =3D 1.25 =3D 0.444 =3D 454 ;1/1 + 1/8 =3D 1.125 =3D 0.471 =3D 481 ; ;1/2 =3D 0.5 =3D 0.667 =3D 682 ;1/2 + 1/4 =3D 0.75 =3D 0.571 =3D 584 ;1/2 + 1/8 =3D 0.625 =3D 0.615 =3D 629 ;1/2 + 1/4 + 1/8 =3D 0.875 =3D 0.533 =3D 545 ; ;1/4 =3D 0.25 =3D 0.800 =3D 818 ;1/4 + 1/8 =3D 0.375 =3D 0.727 =3D 743 ; ;1/8 =3D 0.125 =3D 0.889 =3D 909 ; ;1/1 + 1/2 + 1/4 =3D 1.75 =3D 0.363 =3D 371 ;1/1 + 1/2 + 1/8 =3D 1.625 =3D 0.381 =3D 389 ;1/1 + 1/4 + 1/8 =3D 1.375 =3D 0.421 =3D 430 ;1/1 + 1/2 + 1/4 + 1/8 =3D 1.875 =3D 0.348 =3D 356 ; ; All 124 128 12 148 14 18 1 248 24 28 2 48 4 8 None Closed ; ; 356 371 389 409 430 454 481 511 545 584 629 682 743 818 909 1023 A/D ; ; 15 16 20 21 24 27 30 34 39 45 53 61 75 91 114 Difference Joe * * ********** Quality PIC programmers http://www.embedinc.com/products/index.htm --_003_362766372BF84E1CA0C281795E9D6B63ivp3ghz_ Content-Type: image/gif; name="DIP_select_AD.gif" Content-Description: DIP_select_AD.gif Content-Disposition: attachment; filename="DIP_select_AD.gif"; size=664; creation-date="Thu, 23 Sep 2010 16:01:32 GMT"; modification-date="Thu, 23 Sep 2010 16:01:32 GMT" Content-Transfer-Encoding: base64 R0lGODlhbAB8AIAAAAAAAP///ywAAAAAbAB8AAAC/oyPqcvtD6OctNqLs968+w8eQDIipRim6Wmw geuqsnbWYwnc877Vbat7xXhESfCF8hWXk6NPyYw+WLhgToptwKzHrPcLDot3ubL5Ok4Lh2oxux1+ w7/yebZul+LzzD2/6PfHEyg4Q1goc4i4suil2GgR8whJgYZCaYh0iUlGwtnp+akyNCnqwFZqukCq OtgK+joaCzvLWGt7C5Kau4ohubar9tiFBGU6rPmTvAwU3HfRhWNCYllYbbQpnX3G3e39DR4urnh2 SUWNV2Z0rcXO4H7qCUUKP91UiZ+fJKJOox9ByJmsewSx2Qn4D4JAXAATTsmDsGDDgw7jSWwT0aBG /jgZJ27EWFFLSDcje10UVlJBR5AnLX5k+dKlR44pQ8VMs/JhyzE5ZSrk01PkTpJDTd7kWdPe0ThJ N82kWVRlUyxB300lUk1O1lPn2imN0/Vd2FVjVZalc7Uq06g2n6Jk+/UnRbhO5c5RK5Uu1bRXo+Bt axfq0ryD0eplpvMu38N+Fxc2/LhuYsWH/95x7PZyXH4wJqO6tpDGWWXJ6lhClQ2pMaGmNb1REprD aJtaS7ebrVlyXNTLWJFG7Igw4N+ct9Iennvza6G7JceGJrwZaJ/0flGOTHzyW+zAmcPM7D2wYPBW GTeu3PcZevNLLOsOv528Uflg3Gf3GV+89v04OTHr77+OH/0o9JwH4xyIIDi8fFDPgpE4aCCEHRRY C4WzWBgLhq9oyEk4En7oFzcgjhgihySeSEEBAAA7 --_003_362766372BF84E1CA0C281795E9D6B63ivp3ghz_ Content-Type: text/plain; name="ATT00001.txt" Content-Description: ATT00001.txt Content-Disposition: attachment; filename="ATT00001.txt"; size=208; creation-date="Thu, 23 Sep 2010 16:01:32 GMT"; modification-date="Thu, 23 Sep 2010 16:01:32 GMT" Content-Transfer-Encoding: base64 LS0gDQpodHRwOi8vd3d3LnBpY2xpc3QuY29tIFBJQy9TWCBGQVEgJiBsaXN0IGFyY2hpdmUNClZp ZXcvY2hhbmdlIHlvdXIgbWVtYmVyc2hpcCBvcHRpb25zIGF0DQpodHRwOi8vbWFpbG1hbi5taXQu ZWR1L21haWxtYW4vbGlzdGluZm8vcGljbGlzdA0K --_003_362766372BF84E1CA0C281795E9D6B63ivp3ghz_-- .