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

Connect lcd 2x16 with the same port of keyboard 4x4(portb)

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



Joined: 07 Mar 2012
Posts: 5

View user's profile Send private message

Connect lcd 2x16 with the same port of keyboard 4x4(portb)
PostPosted: Thu Mar 08, 2012 5:06 am     Reply with quote

Hi everybody, I'm a newbie in microcontroller and I have used the flex driver for my 4x4 keyboard but i want to connect my lcd 2x16 in the same port b with the keyboard. How can i do this ? Please help friends, I need it for my school project. Thanks for your interest Smile and if you can show me the schematic how can I do that, thanks a lot Smile I forget to say I'm using pic16F876. Thanks for helping ...
temtronic



Joined: 01 Jul 2010
Posts: 9225
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Mar 08, 2012 6:38 am     Reply with quote

everything you need, CCS kindly supplies......look in the EXAMPLES folder.

hint... for the LCD , look for a file with LCD in it...

hint... for the KPD, look for a file with KPD in it....

hint... when your propject is open, press F11....
koko87



Joined: 07 Mar 2012
Posts: 5

View user's profile Send private message

PostPosted: Thu Mar 08, 2012 6:46 am     Reply with quote

Thanks temtronic
I know how to use the functions of keyboard and lcd and i make examples of it with lcd and keyboard separated. But when i want to use the same port its not working. I don't know why. I use keyboard 4x4 in port b and I want to use the same port b to run my lcd. How can i do that ? Thanks temtronic for helping me and thanks for your interest.
Ttelmah



Joined: 11 Mar 2010
Posts: 19506

View user's profile Send private message

PostPosted: Thu Mar 08, 2012 8:53 am     Reply with quote

Not easy to do.
Realistically, it is possible, by adding two 2-4 line decoder/multiplexors, fed from the four data lines to the LCD, with the keyboard matrix fed from these, and the output from one feeding the unused bit in the bottom of the port. Then when the LCD is not being written to (EN not selected), you can put a key number onto the high four lines, and test the input to see if this selected key is on/off.
Without extra hardware like this, I don't think it is possible.

Best Wishes
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 08, 2012 12:27 pm     Reply with quote

See this post. It uses the CCS keypad and lcd drivers, not the flex drivers:
http://www.ccsinfo.com/forum/viewtopic.php?t=26229&start=2
Ttelmah



Joined: 11 Mar 2010
Posts: 19506

View user's profile Send private message

PostPosted: Thu Mar 08, 2012 4:02 pm     Reply with quote

Problem is that if you hold a combination of keys down while the LCD is actually updating, the display will be incorrect.
May not be likely, or matter, but for me this makes it unusable.

Best Wishes
koko87



Joined: 07 Mar 2012
Posts: 5

View user's profile Send private message

PostPosted: Thu Mar 08, 2012 6:41 pm     Reply with quote

Thanks all of you, but it seems that i have no solution to do it and I'm obliged to use another port but one question. Why when i use the flexible lcd driver 2x16 with port A of my pic16F876 he don't work!!! But when i use the port C he work fine. Any ideas!!! Should i have to add something or what ? Thanks friends for helping Smile, im using my lcd 2x16 in port b with thr originale lcd driver lcd.c the probleme that i want to change juste the three pins E,rs,rw to the pin_A0,pin_A1,pin_A2,how can i do that and what change i have to do it to the lcd.c to get work thanks a lot for you interresting frinds thanksssss Smile and thanks for your time to answer and helping me Smile
Ttelmah



Joined: 11 Mar 2010
Posts: 19506

View user's profile Send private message

PostPosted: Fri Mar 09, 2012 2:51 am     Reply with quote

Help if you said 'what chip'. However odds are you are using one where port A wakes up setup for analog.
Use flex_lcd, rather than lcd.c. This allows the pins to be anywhere. Smile

Best Wishes
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

Port A
PostPosted: Fri Mar 09, 2012 4:47 am     Reply with quote

Again without telling us which PIC, you're making it difficult for us to help. Read the CCS forum guide.

As well as Ttelmah's hint. On many PICs RA4 is open drain. If you are connecting data bits to RA4/5/6/7, then A4 won't pull up!

Mike
koko87



Joined: 07 Mar 2012
Posts: 5

View user's profile Send private message

PostPosted: Fri Mar 09, 2012 6:32 am     Reply with quote

thanks , im using pic16F876 and i have branched the lcd to port b and using lcd.c not flexible driver then i branched my keyboard 4x4 in port b and c im looking for use the port A for my lcd 2x16 ,and when i use the flexible lcd is not work if use them with the port b or c or a he said combination logic problem ?any ideas thanks
temtronic



Joined: 01 Jul 2010
Posts: 9225
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Mar 09, 2012 7:08 am     Reply with quote

You've got to read the datasheet and understand what it says.
Some pins on PortA may not be suitable for your project.You have to check and make sure that the pins you select are good for your design.Do you need a pin to be just an output, an input or both ? On epin RA4 is open drain, all have 'other uses' and those 'uses' must be disabled.
Mike,Mr T and others will help you but you have to read and comprehend the basic operation of the PIC.
Generally speaking PORTB is the easiest 8bit I/O port for LCD/KPD use.If available, I'd use it for 'my first project'.
koko87



Joined: 07 Mar 2012
Posts: 5

View user's profile Send private message

PostPosted: Fri Mar 09, 2012 7:24 am     Reply with quote

you are right temtronic thank you and thanks for Mike Walne,Ttelmah,PCM programmer, i will see again the datasheet may be i miss something that i don't see it ;) thanks all of you i know you will help me it the famous forums thanks.
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