Paul B. Webster" wrote: > Subject: Re: BCD Thumbwheels > > 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? > > Yes, use a 4000 series parallel-in, serial out shift register with the > requisite number of inputs (just looking for one in the specs!). There is such a shift register in the 7400 series. Of course you'll need twelve pull-up (or pull-down if CMOS) resistors as well. From the GIICM (http://www.xs4all.nl/~falstaff/GIICM.html) we get this pinout: 74674 16-bit parallel-in serial-out shift register. +---+--+---+ /CS |1 +--+ 24| VCC SCLK |2 23| P15 R//W |3 22| P14 |4 21| P13 MODE |5 20| P12 S/Q15 |6 74 19| P11 P0 |7 674 18| P10 P1 |8 17| P9 P2 |9 16| P8 P3 |10 15| P7 P4 |11 14| P6 GND |12 13| P5 +----------+ There is an even more peculiar way of doing things if you can't find the 74674. Use a (74HC)4040 12-bit ripple counter, and connect diodes to the outputs, and then from the diodes connect the switches to one common input pin with suitable pull-down resistor. Then reset the counter, and clock to the states 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 and 2048, each time reading the state of the input line. Of course, this may not be the fastest way, requiring approx. 5 PIC clock cycles per 4040 clock, so that is about 11000 cyles to read the twelve switches. Frank ------------------------------------------------------------------------ Frank A. Vorstenbosch Phone: +44-181-636 3391 Electronics & Software Engineer or: +44-181-636 3000 Eidos Technologies Ltd., Wimbledon, London Mobile: +44-976-430 569