Hi Dwayne, Thanks for the nice suggestion that enables me to save one more I/O pin. Incidentally, in my experiments with the 4021, I found a method to use the IC for 9 PB switches instead of only 8. The sequence is like this: (The inputs of 4021 for the 9 switches are connected +5V through pull-up resistors. When a PB switch is pressed, the corresponding input goes low.) Connect switches 1 - 8 to P7 - P0 input pins of 4021 respectively. Connect switch 9 to pin 11 (Serial Data In) of 4021. 1. Make pin 9 (PL input of 4021) high to parallel load the 8 input bits into the shift register. Make pin 9 low again. 2. If pin 3 (output of the last stage) is low, switch 1 has been pressed; take appropriate action. 3. Serially shift 8 bits one by one and check each bit. If a bit is low, it means the corresponding switch (one of the remaining switches from 2 to 9) has been pressed; take appropriate action. 4. Go to step No.1. This may be helpful to those who are not already aware of it. Regards, Bala > -----Original Message----- > From: Dwayne Reid [mailto:dwayner@PLANET.EON.NET] > Sent: Saturday, December 15, 2001 12:17 AM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: [EE]: Which is the ideal IC? > > > At 11:01 PM 12/12/01 -0600, Bala Chandar wrote: > > >I like the suggestion by Tim McDonough of using 4021 that will give 8 > >inputs. (74HC165 can also be used, I think, as it looks a functional > >equivalent of 4021.) Since I already have two pins working > as common Clock > >and Data outputs, I can use them for 4021 as Clock and Load > outputs. This > >means, by using only one pin to receive the serial data, I can get 8 > >additional inputs. > > You can avoid using that extra pin by using the data pin used > to talk to the output SRs as an input pin. Just add a single 10K > resistor in series with the data out pin of the 4021 and feed the > serial data pin on the PIC. Set the pin as input, read the 4021, > set the pin as output, write the output SRs, assert strobe. > > I do this in most of my products: 3 pins to talk to all my SR > based inputs and outputs. Add 1 more pin if I am also talking to my > watchdog chip of choice (Xicor X25043). > > dwayne -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads