It works like a D/A with each switch being a binary count input. 1,2,4,8,... The number represented by the switch combo is translated to an analog value by the R/2R ladder and the A/D reads the value. You use a look up table type of code to determine the switch combo ie if between 1.05 and 1.35 it is switches 3 and 5 or some such value you have calculated. The problem is in the number of switches. Theoretically you can use 8 switches with an 8 bit converter but with tolerances and noise I usually have 4 or 5 that I set as a limit. Larry At 02:24 PM 4/16/03 -0500, you wrote: >Just saw this approach, and wondered how does one know which combinations >are presed? > > >And how can one press all 4 buttons at once and get correct output? > >-----Original Message----- >From: Larry G. Nelson Sr. [mailto:l.nelson@IEEE.ORG] >Sent: Wednesday, April 16, 2003 10:02 AM >To: PICLIST@MITVMA.MIT.EDU >Subject: Re: [OT:] different approach to keyboard scanning? > > >Another method is to use an R / 2R ladder configuration. That allows you to >have multiple key presses or chording. There is a real limit due to >resolution of the converter and accuracy of the components but this method >lets you use resistor networks and the absolute value is less important >than the match between components. 4 buttons allows 16 combinations and >works well with a PIC 8 bit converter. I did this 7 or 8 years ago and many >of you probably have used the product it is in. >Larry > > > >At 10:34 AM 4/16/03 -0400, Wagner Lipnharski wrote: > >Edson Brusque wrote: > > > Hello, > > > > > > I've been thinking about using the PIC A/D to scan a 16 keys > > > keyboard. The example bellow have only 4 keys for simplicity: > > > > > > ,----K1----VDD > > > | > > > 1k > > > | > > > +----K2----VDD > > > | > > > 1k > > > | > > > +----K3----VDD > > > | > > > 1k > > > | > > > ADC----+----K4----VDD > > > | > > > 1k > > > | > > > GND > > > > > > Without any key pressed, the ADC would read 0V, with K1 pressed > > > it would be 1.25V, with K2=1.66V, K3=2.5V, K4=5V. > > > > > > I think this would be very interesting for projects using a PIC > > > with ADC and short of I/O. > > > > > > Best regards, > > > > > > Brusque > > > > > >Other than that, look this design we made and used 11 years ago; > > > >http://www.ustr.net/electronics/akeys.shtml > > > >Wagner. > > > >-- > >http://www.piclist.com hint: To leave the PICList > >mailto:piclist-unsubscribe-request@mitvma.mit.edu > >Larry G. Nelson Sr. >mailto:L.Nelson@ieee.org >http://www.mchipguru.com > >-- >http://www.piclist.com hint: To leave the PICList >mailto:piclist-unsubscribe-request@mitvma.mit.edu > >-- >http://www.piclist.com hint: To leave the PICList >mailto:piclist-unsubscribe-request@mitvma.mit.edu Larry G. Nelson Sr. mailto:L.Nelson@ieee.org http://www.mchipguru.com -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics