From: NAME: Vincent Himpe To: "piclist@mitvma.mit.edu"@oberon@mrgate What about this solution : Use I2C. You can have enormous keyboards hooked up with only 3 pins. Using unscanned keys. Attach a 8574 or 8574a for every 8 keys you need. You have no software overhead except for a small routine to read the chips. Hook up the interrupt lines of the chips to your cpu. If a statechange occurs of one of the inputs the chps will assert an interrupt to the pic. The pic then quickly scans the keyboard and presto. Instant keyboard scan without waisting cpu time when no key is pressed. You can attach 16 of these in total ending up with 128 keys. Ennoug to scan a complete ibm pc keyboard.(of course heavily modified) Other solution. Use one PCF to drive and one to receive. Again use the same trick. In the programs dead time generate scancodes. When no interrupt comes from the pcf8574 nothing happens. when a key is pressed : interrupt : the pic reads the second 8574 and can calculate the key pressed. This gives you 64 keys with only 3 lines. How's that for a bargain ? If you extend this further you can have a total of 8 drivers and 8 receivers giving you a keyboard which can occupy 64*64=4096 keys with only 3 pins and still minimal software overhead. Who can do better ? :-). ( who will need that kind of a keyboard ? Maybe a japanese wordprocessor :-) ) Note: With PCF and 8574 i am referring to the PCF8574 or PCF8574A from philips. This is an i2c 8 bit parallel i/o port. with interrupt generator on status change of the inputs. Software routines to handle i2c are very easy. with about 100 bytes or less you can handle the 4096 key keyboard. Regards Vincent Himpe vi_himpe@mietec.be vincent.himpe@ping.be