http://www.piclist.com/techref/microchip/sw7_on_1pin.htm The clicks where "FAQ", "I/O", "Keyboards", "7 switches with 1 A/D pin by Bob Axtell" Seaching for "Bob Axtell A/D keyboard" it is the 6th entry down. -- James. -----Original Message----- From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On Behalf Of Bob Axtell Sent: Thursday, November 29, 2007 10:12 To: Microcontroller discussion list - Public. Subject: Re: [EE]: four buttons on one A/D pin Gee, I delivered an actual working schematic and i KNOW James posted it in the archives, but I can't locate it on this exact subject. I use 8 resistors for 7 pushbuttons. Each button is separated by about 0.5V. --Bob Eoin Ross wrote: > http://en.wikipedia.org/wiki/Resistor_Ladder > > With this you basically have a binary number from the A2D with bits matching your pressed buttons. > Ignore the lower couple of bits from your 8/10/16 bit A2D values > > If your buttons were arranged top to bottom... > > (ASCII art in MS Sans Serif, Regular, 8 point font) > > Vcc > | > | > | 2R > +-----B4-----/\/\/\/-----+--------------> PIC A2D pin > | | > | \ > | / R > | \ > | 2R | > +-----B3-----/\/\/\/-----+ > | | > | \ > | / R > | \ > | 2R | > +-----B2-----/\/\/\/-----+ > | | > | \ > | / R > | \ > | 2R | > +-----B1-----/\/\/\/-----+ > | > \ > / 2R > \ > | > | > GND > > > > >>>> rob@silk.net 28 Nov 07 20:38:02 >>> >>>> >> Think binary :) >> > > I'm trying! Do you mean for me to binary weight the four switch resistor > values (R4=2xR3; R3=2xR2; R2=2xR1)? I'm okay with that, but how does one > optimize the value of the common pull-up resistor to minimize bunching of > the resulting _voltages_, keeping in mind that V= 5 x (Rx / (Rx+Rpu))? Is > some sort of scaling factor required for the four otherwise-binary-weighted > resistors to offset the bunching effect? The system needs to reliably > distinguish between the case where all four buttons are pressed > simultaneously, and any one of the possible 3-button combinations. My > back-of-an-envelope scenarios yield some voltage values that are less than > 1% apart, which is too tight for comfort. The archived solutions some folks > have kindly identified seem to be invalid for multi-button combinations, > which doesn't work for this situation. Any more hints? > > Thanks, > RR > > > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist