Alec Myers wrote: > Does any know a cute way of reading three BCD thumbwheels that uses > less than > i) Twelve i/o pins > ii) Seven pins and 12 diodes? Yeah, Alec... You can do it with only three I/O pins if you're willing to add a little external hardware: Get two 8-bit serial shift-registers and cascade them to make a 16-bit shift-register. Now tie 12 of the shift-register outputs to one side of each thumbwheel switch. Tie all 12 pins on the other side of the switches together, run them to a single I/O pin on the PIC, and put a pull-down resistor on that pin. Configure that pin as an INPUT. Tie the shift-register Latch (or Strobe) pins together and pull them high (or low if the Latch/Strobe signal is low-true). Tie the shift-register Clock pins together and run them to an I/O pin on the PIC. Make that pin an OUTPUT. Tie the first shift-register's Data pin to a PIC I/O pin and make that pin an OUTPUT, as well. Now... To read the switches, first clear the shift-registers by clocking 16 "0" bits into them. Then clock a "1" bit in and read the INPUT pin. If it reads "1", the first switch is closed; if it reads "0", that switch is open. Clock 11 "0" bits into the shift register, one at a time. This will push that single "1" bit through the shift-register, applying it to each switch in turn. After each "0" bit is clocked in, check the INPUT pin; its state indicates whether the corresponding switch is open or closed. Shift registers aren't as cheap as diodes, but since you're already spending the bucks for those thumbwheel switches, you can probably afford them. If this didn't make sense to you, let me know and I'll try to clarify my description. If you ask real nicely, I may even draw up some really awful ASCII art to illustrate it. -Andy === Andrew Warren - fastfwd@ix.netcom.com === Fast Forward Engineering - Vista, California === http://www.geocities.com/SiliconValley/2499 === For PICLIST help (including "unsubscribe" instructions), === put the single word "help" in the body of a message and === send it to: listserv@mitvma.mit.edu