PDA

View Full Version : how to connect 2 LCDs on a PIC



f1fco
- 12th April 2004, 21:38
hello
I am a french ham radio
it is my first connection to this forum
and my english is very poor...

I am using PBP 2.4.2 and several pics (16F628, 876, 877 and alson 18F252 and 452...) and bootloader from Mecanique.co.uk

my first question :

is it possible to control 2 LCDs (each of 4x20characters) with 1 PIC

by example 1 LCD on 6 pins of PORTB (4 datas, RS and En) and the second LCD on 6 pins of PORTD (4dats, RS and En) of a 16F877

my application need to display 8 lines of informations
and LCD have only 4 lines !


thank you for answer

F1FCO, Pierre

Ioannis
- 14th April 2004, 09:55
The answer in NO. You cannot have two different LCD's connected that way since you use DEFINE's to tell PBP where is connected the LCD.

But you can use serial LCD's and connect more than 1 (2,3,...) since you would need 1 or 2 wires (and a ground of course).

And many pins would be left free also...!

Ioannis

Melanie
- 14th April 2004, 14:25
For cheapness, you can of couse use two PIC's (eg 16F628) one for each LCD, and have those in turn connected to your main application PIC. It would work out a lot less expense than buying ready-made Serial LCD's (in effect you're creating your own 'local' serial LCD network).

ivancho
- 14th April 2004, 14:48
You could also use a data buffer and enable the one with the one LCD you want to send the data to. And you can use the same data pins for all of them, and just "buffer" the Enable for the LCD need to send the data to.

Dwayne
- 14th April 2004, 17:00
Hello F1FCO,

Long time since I talked to someone in France...Maybe on 15 meters, or 20 meters <g>

What you could do, is connect two LCD's up to the exact same PIC (in 8 bit mode), but the Enable pin will of one LCD will go to Port a.0. the Enable Pin of LCD 2 will go to Port a.1, and the LCD control pin (for LCD command/Write) will go on Port a.2. That way you can just "Toggle" Porta.0 if you want that command to go to the 1st LCD. If you want to send the data/command to the second LCD, toggle the porta.1. The other LCD should egnore the data, because you are not "Toggling" it to accept anything.

Thus, with PortB (8pins) and 3 pins of Porta you can control 2 LCD's. If you want to control 3 LCD's it will take 4 pins on Porta. etc.

I used to do EME for quite some time Used KLM 32 element running 1/2 of a Kilo on 2 mtrs. Ran CW for many years. Did a lot of Sat communication... Was able to do Packet, SSTV, RTTY, and standard communication when AO 10 was up

Dwayne

Melanie
- 14th April 2004, 19:42
I have doubts that two LCD's with just an enable toggling between them will function. Most LCD's require an initialisation sequence following power-up which is accomplished by PBP transparantly to you. Therefore only the currently enabled LCD will be initialised, thereafter PBP will sit back safe in the knowedge it's done it's housekeeping. The second LCD will never be initialised and may well fail to respond correctly if at all.

You can of course bypass PBP's LCD routines and write to your two LCD's directly, but first you must acquire the Datasheet for your LCD controller to determine the command sequences required.

Melanie

anj
- 14th April 2004, 21:43
Gday Mel
I was having trouble with a 4Line LCD on a 16F88, but a 2line worked no probs. ( Fixed when i forcibly set RB6 and RB7 to digital outputs. )
However as part of my playing i was trying to run 2 LCDs in parallel. As part of this testing i was also playing with the FLAGS = 0 definition ( as per the book ) to force the LCDs to reinitialise.
If they were to say set LCD1 as default and start the prog, then switch to LCD, set Flags = 0, and write data, wouldnt both LCDs then be initialised, and stay initialised???

Just thought re this, the pic will still default to use the defs for RW and E.
However, if the RW and E pin was connnected to say a 4066 switch, and this switch toggled the lines to the LCDs, then the above process may work, just write to one LCD, toggle the SW, set FLAGS=0, write to LCD, both initialised??

Andrew

Melanie
- 15th April 2004, 00:35
It's really got to be a case of try it and see...

Original
- 15th April 2004, 17:59
Look at this idea:

http://users.picbasic.org/?page=howtodetail&id=33