A nice way to make a diode matrix like this is to sandwich the diodes between two pieces of stripline experiment board (diodes standing up and the strips on both pieces of board 90 degrees rotated) another idea to make a code like this is to take an old eprom , program it with your table and hook the address lines up to your switch (dont forget the output enable line(s)) Peter pvh@vertonet.com peter_van_hoof@hotmail.com peter_van_hoof@mad.scientist.com >From: John Perkinton >Reply-To: pic microcontroller discussion list >To: PICLIST@MITVMA.MIT.EDU >Subject: Re: Best way to interface a 12 pos rotary switch >Date: Thu, 24 Jun 1999 14:24:23 +0100 > >Multiplex your lines then you can get it down to 4 input lines. Use diodes >to multiplex them, and remember to pull the lines high either with >resistors, or internal pull ups if using PortB. > >I use this circuit in a microphone paging console giving me 31 buttons into >5 lines of an input port. And because it only uses 1n4148 diodes to >multiplex it it costs very little. > >I've included a schematic as a wmf file. > >It is great for rotary switches, as it has only one common line, unlike >most >keypad multiplexing circuits, which scan the keys as rows and columns. >----- Original Message ----- >From: Ross Bencina >To: >Sent: Wednesday, June 23, 1999 3:39 PM >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/ > > ><< multi.wmf >> _______________________________________________________________ Get Free Email and Do More On The Web. Visit http://www.msn.com