View previous topic :: View next topic |
Author |
Message |
mattmac24
Joined: 09 Sep 2010 Posts: 7
|
Need help on Flex 20x4 lcd driver |
Posted: Wed Jul 06, 2011 10:21 am |
|
|
Hi, I am only getting my LCD to briefly flicker when running the init function. Can't display any text. I just wanted to check my LCD was compatible even though I'm sure it is before i try a few other things. This is my first attempt at a LCD. I'm using this screen.
It just seems too simple to set up, i think the next step is to resolder all the connections as i don't see anything else i could have stuffed up.
Thanks, Matt |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Jul 06, 2011 2:36 pm |
|
|
1. What PIC are you using ?
2. What CCS compiler version ?
3. Post a list of the connections between the PIC and the LCD. Post the
pin numbers (not the pin names) on each device. Physically trace out
the connections and post them.
4. Post the #define statements at the top of the Flex driver that tell it
what PIC pins to assign to each LCD pin. Also post the #define for
the RW pin, either un-commented or commented out, as actually used
in your program.
5. What's the Vdd voltage that you measure on the PIC and the LCD ?
6. Do you have the recommended contrast control circuit installed, as
shown in their LCD data sheet ? It's different than on most LCDs. Most
LCDs would recommend a trimpot between Vdd and ground, with it set to
give a contrast voltage of about 0.5 volts. This data sheet just shows a
trimpot between the contrast pin and ground. I don't know if that's a
mistake in the data sheet. See page 7:
http://iteadstudio.com/store/images/produce/Display/Character/LCD_2004/LMB204BFC-Manual-Rev0.1.pdf |
|
![](templates/subSilver/images/spacer.gif) |
mattmac24
Joined: 09 Sep 2010 Posts: 7
|
|
Posted: Thu Jul 07, 2011 2:42 am |
|
|
thanks for the quick reply!
1. What PIC are you using ?
PIC18F4585
2. What CCS compiler version ?
4.093
3. Post a list of the connections between the PIC and the LCD. Post the
pin numbers (not the pin names) on each device. Physically trace out
the connections and post them.
Its soldered to a PCB and i have manually checked the connections between the LCD and the PCB and then checked in cad that the pcb traces go where they should. The list i have just below is correct.
4. Post the #define statements at the top of the Flex driver that tell it
what PIC pins to assign to each LCD pin. Also post the #define for
the RW pin, either un-commented or commented out, as actually used
in your program.
#define LCD_DB4 PIN_A1 //
#define LCD_DB5 PIN_A2 //
#define LCD_DB6 PIN_A3 //
#define LCD_DB7 PIN_A5 //
#define LCD_RS PIN_B4 //
#define LCD_RW PIN_B5 //
#define LCD_E PIN_A0 //
I have tried commenting out that line and just attempting to write to the display, no change.
5. What's the Vdd voltage that you measure on the PIC and the LCD ?
4.8v
6. Do you have the recommended contrast control circuit installed, as
shown in their LCD data sheet ? It's different than on most LCDs. Most
LCDs would recommend a trimpot between Vdd and ground, with it set to
give a contrast voltage of about 0.5 volts. This data sheet just shows a
trimpot between the contrast pin and ground. I don't know if that's a
mistake in the data sheet.
I have the 5k Resistor between the contrast pin and ground as it says to in the datasheet for this lcd. I also have 5v going to the backlight(which works) and 5v going to the display. Its all a common ground.
Do you think i should try as you have suggested with the trimpot?
Thanks again for your help:) |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19378
|
|
Posted: Thu Jul 07, 2011 3:51 am |
|
|
Start with a really simple test. Something (hypothetically) like:
Code: |
#include <processor setup file, including clock>
#include <lcd file>
void main(void) {
//any processor setups needed to get access to the pins - turn off
//analog pins for example.
delay_ms(50); //Just allow a little extra time for the LCD to wake
lcd_init();
printf(lcd_putc,"\fTest Message");
do {
} while (TRUE);
}
|
If this fails, look into the lcd file, and increase the time delays in the init code. There are some clones of the Hitachi standard display, that are slower here than the originals....
If you 'comment out' the 'E' line, you need to also comment out the USE_LCD_RW line, and make the connection to ground on the E pin of the LCD.
Test that your clock is running at the speed you are selecting in the clock statement (classic problem would be if the chip was actually running faster than the clock statement says, since then operations would take place faster than the display can handle). Simple LED flash program, at 0.1Hz(say), and verify that the LED _does_ flash at this rate.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
foxOnTheRun
Joined: 17 Apr 2010 Posts: 43
|
|
Posted: Thu Jul 07, 2011 6:02 am |
|
|
Have you tried to power up the display without the PIC attached to data lines? It should display an entire row of black squares.
Just a quick checklist:
_ make triple sure every pin of your PIC is working, times ago I lost days with a LCD and a defective PIC.
_ make sure you don't get confused by PIC pin numbers and actual port number.
_ try to pick at random a pin/wire, and follow it's connection. _________________ Listen, why don't you relax? Take a pill, bake a cake or go and read the encyclopedia. |
|
![](templates/subSilver/images/spacer.gif) |
mattmac24
Joined: 09 Sep 2010 Posts: 7
|
|
Posted: Sat Jul 09, 2011 2:08 am |
|
|
Ok thanks for the tips guys. I increased the delays in the lcd file, that didn't work. I also disconnected the 4 data lines and powered it up. Same response. Just the backlight was on, no other signs of life. I haven't got another PIC to swap in at the moment so a dead pin could be a possibility, although i can vouch for about 75% of the pins working (can't test them all with my current pcb setup). I'll try that tomorrow when i can get another PIC. I'm also going to desolder the whole thing, resolder it and hope that fixes this.
Could this still be a contrast issue? At the moment i have a 5k resistor tied to ground from that pin, what is the 'norm'?
Thanks, Mat |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19378
|
|
Posted: Sat Jul 09, 2011 5:00 am |
|
|
Most multi line LCD's, if powered up _with the contrast voltage set correctly_, with no CPU connected, will display a single text line of squares, darker than the optimum setting.
That your's displays nothing says one of the following:
1) The LCD is not getting power.
2) The contrast voltage is well wrong.
3) The display is faulty.
What is the part number of the display you have?. A few really old models (obsolete now), _require_ a -ve contrast control voltage.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
|