CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

kbd and lcd share the same port

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
lgeorge123



Joined: 05 Dec 2004
Posts: 31

View user's profile Send private message

kbd and lcd share the same port
PostPosted: Sun Jan 03, 2010 7:50 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Jan 03, 2010 8:29 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Jan 03, 2010 12:30 pm     Reply with quote

See this thread for a discussion of using an LCD and keypad on the
same port, using CCS example files:
http://www.ccsinfo.com/forum/viewtopic.php?t=26229
John P



Joined: 17 Sep 2003
Posts: 331

View user's profile Send private message

PostPosted: Sun Jan 03, 2010 1:01 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Jan 03, 2010 4:27 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Jan 04, 2010 4:56 am     Reply with quote

Thanks all of your help !!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group