View previous topic :: View next topic |
Author |
Message |
lacolo
Joined: 10 Mar 2006 Posts: 15
|
One PIC controlling several LCD panels |
Posted: Tue Mar 14, 2006 7:53 pm |
|
|
Hi everyone,
Am I right in assuming that I can control several LCD panels from one pic, where they share all pins except the Enable pin?
I am trying that, and then manually setting HIGH & LOW on the various enable pins. However, the panel that I don't address from the get-go (ie. the one that starts with a HIGH enable pin), does not ever display any characters.
Any thoughts on what I may be doing wrong?
Thanks!
//Cynthia |
|
![](templates/subSilver/images/spacer.gif) |
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
Re: One PIC controlling several LCD panels |
Posted: Tue Mar 14, 2006 10:19 pm |
|
|
lacolo wrote: | Am I right in assuming that I can control several LCD panels from one pic, where they share all pins except the Enable pin? |
It depends on: the type of the PIC, the type of the pannel and on whether or not you are using any additional hardware (such as i/o expanders and LCD drive chips). In other words, please post the description of your hardware! |
|
![](templates/subSilver/images/spacer.gif) |
lacolo
Joined: 10 Mar 2006 Posts: 15
|
|
Posted: Wed Mar 15, 2006 12:46 pm |
|
|
I'm using a PIC18F452 with LCD VK2220 (http://www.wrighthobbies.net/datasheets/VK2220.pdf) and no external hardware.
My pin setup is
LCD pins
1 --- GND
2 --- +5V
3 --- 10K Potentiometer b/w GND & +5V
4 --- PIC pin 20 (D1)
5 --- PIC pin 21 (D2)
6 --- PIC pin 19 (D0) **this is the enable pin I want to control
7 --- 10K to GND
8 --- 10K to GND
9 ...
Thanks.
//Cynthia |
|
![](templates/subSilver/images/spacer.gif) |
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
|
Posted: Wed Mar 15, 2006 1:54 pm |
|
|
Hi Cynthia,
I have never used VK2220, but I have looked at the datasheet. I think selecting between several LCDs using the E pin should work. However I don't understand one thing in your design. VK2220 communicates via parallel bus (DB0-DB7 plus control signals). How are you going to communicate to your LCD, when you are grounding DB0-DB7 throgh 10k resistors?
Cheers,
Nick |
|
![](templates/subSilver/images/spacer.gif) |
lacolo
Joined: 10 Mar 2006 Posts: 15
|
|
Posted: Wed Mar 15, 2006 2:18 pm |
|
|
Thanks, I guess I'll try again
I am only grounding the pins I don't need (communicating with 4-bit data, doesn't use all the data pins.)
//Cynthia |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Mar 15, 2006 3:11 pm |
|
|
Quote: | 7 --- 10K to GND
8 --- 10K to GND
9 ...
I am only grounding the pins I don't need |
The VK2220 data sheet doesn't say exactly what controller it uses.
Keep in mind that if the LCD controller has internal pull-ups, then
when you add 10K pull-downs you are creating a voltage divider.
So instead of holding the pins at a good logic level, you are setting
them at some level in-between a logic '1' and a logic '0'. You are
doing the opposite of what you intend to do.
Example:
Look at the bottom of page 51 of this data sheet for the Hitachi HD44780:
http://www.melabs.com/downloads/hd44780u.pdf
It shows the current for the internal pull-ups on the DB0-DB7 pins
can vary from 50ua(min) to 125ua(typical) to 250ua(max).
With a Vcc of 5v, these currents translate to resistance values of
100K (max resistance) to 40K (typical) to 20K (min resistance).
So the worst case is you have a 20K internal pullup in the LCD controller,
combined with your 10K pull-down. The voltage on the pin is then:
Code: |
10K
---- x 5v = 1.67 volts (maximum)
30K
or
10K
---- x 5v = .45 volts (minimum)
110K
|
So it can vary from .45v to 1.67v, depending on how the silicon process
varies from one batch of controller IC's to the next batch.
On the Vikay data sheet, they say the input voltage for a logic low
level is 0.6v (max) and a logic high level is 2.2v (min).
http://www.wrighthobbies.net/datasheets/VK2220.pdf
So your pull-down resistors could cause the voltage on the unused
pins to be at an incorrect level (between the two valid logic levels).
Vikay gives very little information about the controller. So I don't
know for sure if they have internal pull-ups in their LCD controller IC.
But if they do, then your external pull-downs could cause a problem.
At a minimum, they could allow noise injection into the LCD controller. |
|
![](templates/subSilver/images/spacer.gif) |
lacolo
Joined: 10 Mar 2006 Posts: 15
|
|
Posted: Wed Mar 15, 2006 3:34 pm |
|
|
Thanks! Just tried rewiring that (w/o the resistors), and the LCD works the same way. It works fine, communicated directly with the PIC, but the 2nd panel (for which I'm trying to toggle the Enable), doesn't display any characters.
Any other thoughts?
//Cynthia |
|
![](templates/subSilver/images/spacer.gif) |
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
|
Posted: Wed Mar 15, 2006 3:51 pm |
|
|
lacolo wrote: | It works fine, communicated directly with the PIC, but the 2nd panel (for which I'm trying to toggle the Enable), doesn't display any characters.
Any other thoughts?
|
If you haven't doen it already, try to communicate directly with just the 2nd panel. If you don't suceed, then the problem is somewhere in the wirinng of the 2nd panel. If you do succed, then the problem is actually in the addressing scheme/sequence. |
|
![](templates/subSilver/images/spacer.gif) |
lacolo
Joined: 10 Mar 2006 Posts: 15
|
|
Posted: Wed Mar 15, 2006 4:40 pm |
|
|
Yes, I did succeed. So, I know the problem is in how I am addressing. I was hoping I could just set Enable to HIGH or LOW and have that do it, but apparently not.
Thanks.
//Cynthia |
|
![](templates/subSilver/images/spacer.gif) |
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
|
Posted: Wed Mar 15, 2006 4:50 pm |
|
|
What's your addressing sequence (desired or observed with a scope or logic analyzer, if you have one)? It would be great if you could post a diagram like this one
Code: |
THIS IS JUST AN EXAMPLE
- low
# high/active
R/w ------#####--
E1 -----#######-
E2 -----#######-
D0-D7 -------###---
|
|
|
![](templates/subSilver/images/spacer.gif) |
lacolo
Joined: 10 Mar 2006 Posts: 15
|
LCD.C driver for multiple LCD panels? |
Posted: Wed Mar 15, 2006 8:14 pm |
|
|
This is a follow-up to my question regarding driving multiple LCD panels (http://www.wrighthobbies.net/datasheets/VK2220.pdf) from one PIC18F452.
I neglected to mention that I'm using the built-in LCD.C driver. The issue seems to be that the enable pin is set high and low at different junctures in different routines in there. So you can't just turn it on or off.
I suppose I will have to customize the LCD.C routines to accept a display# parameter, and then change them all to address the enable pin for that display#.
Has anyone written a version of LCD.C for multiple displays?
Thanks!
//Cynthia[/list] |
|
![](templates/subSilver/images/spacer.gif) |
Joseph88
Joined: 14 Aug 2006 Posts: 17
|
|
Posted: Mon Aug 14, 2006 10:50 am |
|
|
Hi guys,
I'm also working on a project that involves the pic 18f452 and multiple LCD's. LCD.C seems to work fine with a single LCD, but does anyone have any sample code for multiple LCD's (namely 24) ?
Thanks in advance,
Joe |
|
![](templates/subSilver/images/spacer.gif) |
|