View previous topic :: View next topic |
Author |
Message |
lgeorge123
Joined: 05 Dec 2004 Posts: 31
|
kbd and lcd share the same port |
Posted: Sun Jan 03, 2010 7:50 am |
|
|
Is it possible kbd and lcd share the same port (e.g. port d ) on microchip mcu like 16f877 using ccs c with standard ccs c library ?? If so, please give me the link or diagram. I also search this forum but no result ! |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sun Jan 03, 2010 8:29 am |
|
|
You either need additional outputs to drive the key matrix or logic to deselect the keyboard with active E signal.
Also decoupling diodes may be required. Generally, you have to care, that the LCD operation isn't blocked with
any combination of pressed keys. Following this idea, you're hopefully able to figure out the details. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
John P
Joined: 17 Sep 2003 Posts: 331
|
|
Posted: Sun Jan 03, 2010 1:01 pm |
|
|
I've done this, and in fact I made each pin that sends data to the LCD do 2 other jobs--read a keypad, and drive an LED or a transistor (the transistor controls the LCD backlight).
As FvM says, "Generally, you have to [take] care, that the LCD operation isn't blocked with any combination of pressed keys". That's true, but there may be times when it's acceptable to let the user be careless, and take the consequences. In my design, combinations of keys are allowed if they're in the same row. Otherwise yes, the display is likely to show the wrong thing.
Here's part of the circuit diagram:
http://files.myopera.com/John98wbr/albums/661338/KEYPAD_LCD.png
As you might expect, the processor has to go through a little dance in order to keep the various functions from interfering with each other. But it can be done!
Edited to say sorry, the significance of "using ccs c with standard ccs c library" just hit me. Yes, I used CCS C. But not the standard library. |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sun Jan 03, 2010 4:27 pm |
|
|
You can of course give up the demand that any key combination must not interfere with the display operation.
But sometimes simultaneous keypress is required by the application. Furthermore, if you share all
keyboard pins with the display, you have to do more. Possibly series resistors towards the keyboard can
be a solution. But their dimensioning must consider the display internal pullup resistors and limited current
strength of PIC outputs as well. A more general solution would be in using a tri-state buffer controlled by E. |
|
|
lgeorge123
Joined: 05 Dec 2004 Posts: 31
|
|
Posted: Mon Jan 04, 2010 4:56 am |
|
|
Thanks all of your help !! |
|
|
|