CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

[Solved!] LCD Garbage Problem (Picture & Video ;) )

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ELCouz



Joined: 18 Jul 2007
Posts: 427
Location: Montreal,Quebec

View user's profile Send private message

[Solved!] LCD Garbage Problem (Picture & Video ;) )
PostPosted: Wed Jul 18, 2007 12:17 am     Reply with quote

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 Smile )

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! Smile 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 Smile

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

View user's profile Send private message

PostPosted: Wed Jul 18, 2007 8:19 am     Reply with quote

Try plugging the lcd module directly in to the breadboard
Bill Boucher



Joined: 04 Feb 2005
Posts: 34
Location: Chatham,ON,CA

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Wed Jul 18, 2007 8:50 am     Reply with quote

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

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Wed Jul 18, 2007 11:21 am     Reply with quote

I cant see any supply decoupling caps at the PIC?
Wont do any harm to add one Smile
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jul 18, 2007 11:35 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Jul 19, 2007 12:15 am     Reply with quote

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 ! Smile

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 Smile

you made my day :D

Laurent
Bill Boucher



Joined: 04 Feb 2005
Posts: 34
Location: Chatham,ON,CA

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Thu Jul 19, 2007 7:30 am     Reply with quote

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 ! Smile

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 Smile

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group