If you are willing to periodically poll the keyboard an inexpensive and reliable solution is to use 4021 CMOS shift registers to connect switch inputs. They require a clock, strobe, and data connection to the microcontroller. If you read the shift register inputs every 100mS a human will generally not be able to detect that their keypress was not instantly recognized. To read the inputs the strobe signal is asserted to latch the data on the inputs. Then the clock line is used to shift the data bits out to the micro one at a time until all have been read. The 4021 also has a serial input so you can cascade the devices together and add as many digital inputs as required in groups of 8. Tim ----- Original Message ----- From: "Bala Chandar" To: Sent: Monday, December 10, 2001 5:11 AM Subject: Re: [EE]: Which is the ideal IC? > In my circuit, I am using all the 8 pins of Port B and pin 6 of Port A as > inputs to detect the closing of 9 PB switches. The PIC used is 16F628 with > internal RC Oscillator. Port B weak pull-up is enabled and PortA.6 has a > 4.7K pull-up resistor. > > As I am running short of I/O pins, I want to use an IC to reduce the number > of pins used by the PIC for detecting key pressings. After a search through > CMOS data book, I found 74HC147 (10 to 4 Priority Encoder) almost ideal for > the purpose. With this IC, I will need only 4 pins of the PIC and as many as > 5 pins will become available. > > Now, my question: Is there a better IC for the purpose? > Please let me know if there is. > > Thanks & Regards, > Bala > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. > > > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.