At 20.04 2005.04.12 -0700, you wrote: >The "analog trick" is interesting. Where only one switch at a time is >closed, I've used a resistor network to make a voltage divider with >several taps. I then use SPDT switches to tap off the voltage divider to >the A/D input on the PIC. The signal is "looped through" the NC contacts >of the other switches so we end up with a sort of priority encoding. This >prevents an invalid input if more than one switch is pressed. Instead, >just the switch "closest" to the PIC is recognized. > >I've used a similar technique to "encode" 15 momentary switches on a pair >of wires that are across the room somewhere. Multiple sets of boxes can be >put across the same pair of wires to put several switch sets in a room. > >As a previous poster mentioned, I also like to TRY to leave RB6 and RB7 >free for the ICD-2 for debugging. Of course, you can connect switches or >other I/O to these pins as long as they don't interfere with the ICD. My >luck (or lack of luck) has been that the part of code that needs the most >debugging is, of course, the stuff on RB6 and RB7. > >Finally, on scanning matrix keyboards, I've generally set the column lines >high, then put them low one at a time and watch the row lines. If the user >presses enough keys simultaneously, you end up with two columns shorted >together, shorting a high output to a low output on the PIC. Not real >good... I should probably add some current limit resistors in series with >these lines, but that's more parts! Or e.g. a 1N4148 diode for each key and the problem is completely solved. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist