Repost with some additions: don't think the 1st version made it to the list. David Harris wrote... >CHALLENGE: can you scan a keyboard, and run an LCD display with only 8 pins/bits >= 1 port -- without extra active hardware? The minimum component solution requires 9 pins unless you drop to a 4x3 (12 button) keypad. But if you don't mind some extra passive components (including 4 small signal diodes), I think you can do a LCD plus 4x4 keypad PLUS 1 more input with only 6 pins. You will want to read the inputs as active LO because of the weak pullups present on the data lines of most LCD controllers. Thats kind of sucky because you would have more tolerance with input logic thresholds if you were reading inputs as logic HI but thats life, I guess. PIC lines 3..0 connect to LCD data lines 7..4. PIC lines 3..0 also connect to keypad rows with 4k7 series resistors. PIC lines 3..0 also connect to keypad columns via 4 diode-capacitor networks: cathode to PIC pin, anode to keypad column and .001uF cap to GND. You also need 100k resistor pullups to the keypad columns and may want to add them to the rows as well (the pullups in the LCD module vary quite radically). 2 more PIC lines connect to LCD RS and E lines as usual. Line RS can also be used as another input to the PIC by resistively coupling with a 4k7 or 10k resistor. Line E must be dedicated to that function only. Talk to LCD as normal. You may want to pre-discharge the caps (set lines 3..0 LO for a few uS) before talking to the LCD but it shouldn't really be necessary. To read keypad, set PIC lines 3..0 HI for a few uS, then tri-state lines 3..1 and set line 0 low for a few more uS, then tri-state it as well. Wait a few more uS, then read the port. Go off and do something useful for a couple of hundred uS, then set line 1 low for a few uS, then tri-state it. Wait for a few uS and read the port. Repeat with lines 2 & 3. The important thing is to ensure the un-selected hold capacitors have a chance to charge well above 3V or 4V before trying to read the desired column. Total component count: 1- 10 pin bussed SIP (100k), 1- 8 pin iso SIP (4k7), 4- 1n4148 diodes, 4- 1n0 mono caps. I do something similar to this in several of my products - some of those have been in current production for the past 7 years or so. The technique is relatively easy to implement. The version that I'll put together (sometime this week) will be identical to the above except that I'll use 10n capacitors - the background routine on most of my projects executes every millisecond. Since its no effort for me to poll the keypad at 1 ms intervals, I can afford the extra charge time that 10n caps require. I'll post code when I'm done. dwayne Dwayne Reid Trinity Electronics Systems Ltd Edmonton, AB, CANADA (780) 489-3199 voice (780) 487-6397 fax Celebrating 18 years of Engineering Innovation (1984 - 2002) .-. .-. .-. .-. .-. .-. .-. .-. .-. .- `-' `-' `-' `-' `-' `-' `-' `-' `-' Do NOT send unsolicited commercial email to this email address. This message neither grants consent to receive unsolicited commercial email nor is intended to solicit commercial email. -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads