View previous topic :: View next topic |
Author |
Message |
ELCouz
Joined: 18 Jul 2007 Posts: 427 Location: Montreal,Quebec
|
[Solved!] LCD Garbage Problem (Picture & Video ;) ) |
Posted: Wed Jul 18, 2007 12:17 am |
|
|
Hi,
I'm trying to get the lcd working right but after searching to this forum i can't find any solution to what i 'm currently getting on the lcd.
See by yourself (WMV9 ~800k ... it's blurry but you can see whats going on )
First Video [Removed sorry you're too late ;) ]
Second Video [Removed sorry you're too late ;) ]
Wiring:
[img]http://example.com [Removed sorry you're too late ;) ][/img]
That's very weird because the cable is short 10 inch (i've seen ppl using 1-2 meter cable) and the caracters are moving in random for a while then display Hello World! then display more garbage...
This is the code:
Code: |
#include <18F2550.h>
#FUSES NOWDT,INTRC_IO, NOPROTECT, NOBROWNOUT,NOPUT,NOLVP
#use delay(clock=8000000)
#define use_portb_lcd 1
#include <LCD>
#use standard_io (B)
void main()
{
lcd_init();
printf(lcd_putc, "\f");
printf(lcd_putc, "Hello World! :)");
while(1);
}
|
maybe it's a timing problem ... i dont know how to change that :(
Many thanks
PS: yup i checked continuity on each cable to see if there was a fault... nothing weird everything is good ...i followed the lcd.c directive for wiring and
this lcd pinout http://www.goblack.de/desy/digitalt/aktoren/lcd-hd44780/lcd-pinout.gif
Laurent
edit: oops .. oh yeah its a 2x20 lcd and i'm using the internal oscillator @ 8mhz (no quartz on hand lol )
Last edited by ELCouz on Sat Jul 21, 2007 11:14 pm; edited 2 times in total |
|
|
kevcon
Joined: 21 Feb 2007 Posts: 142 Location: Michigan, USA
|
|
Posted: Wed Jul 18, 2007 8:19 am |
|
|
Try plugging the lcd module directly in to the breadboard |
|
|
Bill Boucher
Joined: 04 Feb 2005 Posts: 34 Location: Chatham,ON,CA
|
|
Posted: Wed Jul 18, 2007 8:50 am |
|
|
A standard LCD has a built-in minimum internal setup time after powerup before it will properly accept commands. I suggest putting a short delay in your program that runs before the first attempt to talk to the LCD. Try delay_ms(100) before the LCD_init(). |
|
|
SET
Joined: 15 Nov 2005 Posts: 161 Location: Glasgow, UK
|
|
Posted: Wed Jul 18, 2007 11:21 am |
|
|
I cant see any supply decoupling caps at the PIC?
Wont do any harm to add one |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Jul 18, 2007 11:35 am |
|
|
Here's a thread with a similar LCD problem.
http://www.ccsinfo.com/forum/viewtopic.php?t=31167
Click on the links the photos. It's similar to yours, though more
neatly done.
Then read the post near the bottom of the thread. The entire problem
is due to bad connections on the breadboard. My belief is that you
probably have the same problem. |
|
|
ELCouz
Joined: 18 Jul 2007 Posts: 427 Location: Montreal,Quebec
|
|
Posted: Thu Jul 19, 2007 12:15 am |
|
|
Problem Solved!
Quote: | Try delay_ms(100) before the LCD_init(). |
i tryed with 1000 ms just to be sure lol ... work like a charm YES !
PS:i don't understand why 99% in the ppl in this forum never have this line of code before lcd_init() is it because my lcd is cheap an is slow to boot ???
Thanks bill & everyone else
you made my day :D
Laurent |
|
|
Bill Boucher
Joined: 04 Feb 2005 Posts: 34 Location: Chatham,ON,CA
|
|
Posted: Thu Jul 19, 2007 7:30 am |
|
|
ELCouz wrote: | Problem Solved!
Quote: | Try delay_ms(100) before the LCD_init(). |
i tryed with 1000 ms just to be sure lol ... work like a charm YES !
PS:i don't understand why 99% in the ppl in this forum never have this line of code before lcd_init() is it because my lcd is cheap an is slow to boot ???
Thanks bill & everyone else
you made my day :D
Laurent |
Hey, I'm glad I finally said something useful to someone. I think that a lot of other folks programs simply spend some time doing a few other startup things before getting around to talking to the LCD. There's nothing abnormal about your LCD. All the standard modules with built-in controllers require the startup delay. A whole second is overkill but you may find a specific value indicated in the LCD datasheet. There's usually a different delay for each of many functions and a table specifying them all. It is possible to use the LCD's "busy flag" to determine exactly when it is okay to do the next command but this requires a 2-way connection and a little more code. When connected directly to the PIC, this is possible because of the PIC's 2-way I/O. It is also possible to program a short fixed delay to occur after each command automatically. I haven't read the CCS LCD code recently so I forget if it includes a delay or busy-flag detection or not but it works okay so it is doing something appropriate. The startup delay is all you have to worry about. |
|
|
|