Another thought, if you don't mind including 20 little diodes between the 12 switch contact and the 4 pins, is a desecrate 12 to 4 demux. E.g. contact 0 is not connected at all (reading 0000 implies position 0), contact 1 is connected to pin 0 via a diode (reading 0001 = position 1), contact 2 to pin 1 (always use a diode!) (0010 = 2), contact 3 to pin 0 and 1 (two more diodes) (0011 = 3) and so on to position 11 which is connected to pins 0,1, and 3 (1011 = 11). James Newton, webmaster http://get.to/techref jamesnewton@geocities.com 1-619-652-0593 phone > -----Original Message----- > From: pic microcontroller discussion list > [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of Ross Bencina > Sent: Wednesday, June 23, 1999 7:39 AM > To: PICLIST@MITVMA.MIT.EDU > Subject: Best way to interface a 12 pos rotary switch > > > Hi PICsters, > > I have a 12 position single pole rotary switch that I'd like to > interface to > a 16F84 and I don't have 12 spare IO pins ;) (Ideally I'd like to > use 4 pins > or less). I've seen examples of using a resistor lader and an RC timer > circuit (uses too much cpu time for my purposes), presumably > there's also a > logic chip (demux?) that will do the job, I'm just wondering if > I've missed > any other obvious, minimal, and/or clever solutions to this problem. > > Thanks in advance. > > Ross B. > ................................. > http://www.audiomulch.com/~rossb/ >