One thing that is common on a Basic Stamp is to use the same arrangement but instead of a voltage divider you make the varying resistance connect to a capacitor. Then you can measure the time required to charge the capacitor. Now you can just use a general-purpose I/O pin. You pick your resistors so the values are far enough apart that you can't go wrong. Still can't really press more than one (or could you? -- maybe you could select values smart enough that any two would still be unique?). I agree, I wouldn't tie up an A/D just for that, but the RC arrangement is great -- I've used it myself. Al Williams AWC * Floating point A/D http://www.al-williams.com/awce/pak9.htm > -----Original Message----- > From: pic microcontroller discussion list > [mailto:PICLIST@MITVMA.MIT.EDU] On Behalf Of Alan B. Pearce > Sent: Monday, February 11, 2002 5:31 AM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: [PIC]: CHALLENGE: 4x4 keyboard and LCD with 1 > port = 8 bits > > > >The "matrix voltage divider" method I posted yesterday may have been > >cute, but it's awfully cheap 'n dirty: it doesn't resolve multiple > >simultaneous keypresses; it requires a PIC with at least a > 10-bit A/D > >converter; the voltage levels it outputs for each keypress cannot be > >known precisely at design time because of resistor > tolerances; and the > >voltage levels aren't distributed evenly over the A/D > converter's input > >range. In sum, this voltage divider scheme makes extremely > efficient > >use of hardware but it's awfully inconvenient to use. > > With surface mount resistors being 1% tolerance, and E24 > ranges available, I suspect that with an hour or so of > calculating it should be possible to make this arrangement > reasonably foolproof. > > Another trick to do is to have the resistors set up as an > R/2R network like is used inside many A/D converters, and > then each switch represents one particular bit of the A/D > inside the chip. Then for a 10 bit A/D converter one could > probably get 9 switches reliably :) > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads