View previous topic :: View next topic |
Author |
Message |
koko87
Joined: 07 Mar 2012 Posts: 5
|
Connect lcd 2x16 with the same port of keyboard 4x4(portb) |
Posted: Thu Mar 08, 2012 5:06 am |
|
|
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 and if you can show me the schematic how can I do that, thanks a lot I forget to say I'm using pic16F876. Thanks for helping ... |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9228 Location: Greensville,Ontario
|
|
Posted: Thu Mar 08, 2012 6:38 am |
|
|
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
|
|
Posted: Thu Mar 08, 2012 6:46 am |
|
|
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: 19515
|
|
Posted: Thu Mar 08, 2012 8:53 am |
|
|
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
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19515
|
|
Posted: Thu Mar 08, 2012 4:02 pm |
|
|
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
|
|
Posted: Thu Mar 08, 2012 6:41 pm |
|
|
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 , 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 and thanks for your time to answer and helping me |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19515
|
|
Posted: Fri Mar 09, 2012 2:51 am |
|
|
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.
Best Wishes |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
Port A |
Posted: Fri Mar 09, 2012 4:47 am |
|
|
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
|
|
Posted: Fri Mar 09, 2012 6:32 am |
|
|
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: 9228 Location: Greensville,Ontario
|
|
Posted: Fri Mar 09, 2012 7:08 am |
|
|
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
|
|
Posted: Fri Mar 09, 2012 7:24 am |
|
|
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. |
|
|
|