View previous topic :: View next topic |
Author |
Message |
deniska_gus
Joined: 11 Jul 2006 Posts: 42 Location: Minden, Germany
|
My LCD drives me mad! |
Posted: Thu Oct 05, 2006 2:57 am |
|
|
Hi, I'm using PIC16F877A and PCHW3.249
I have tested this small code Code: |
#include <16F877A.h>
#fuses XT,NOWDT,PUT, NOLVP
#use delay(clock=4000000)
#include<lcd.c>
void main()
{
lcd_init();
while(1)
{
lcd_putc("Hallo Welt!\n");
}
}
|
and it doesn't work. I'm using original lcd.c, Quarz 4Mhz. The pins are connected to Port D.
Please help!
Last edited by deniska_gus on Thu Oct 05, 2006 3:49 am; edited 1 time in total |
|
|
Ttelmah Guest
|
|
Posted: Thu Oct 05, 2006 3:09 am |
|
|
A couple of thought/suggestions.
First add a delay. So:
Code: |
while(1) {
lcd_putc("Hallo Welt!\n");
delay_ms(500);
}
|
You are continuously writing to the LCD, and some displays won't actually update if they are having to receive data 'flat out'.
Second, double check the connections. Make sure you have connected the 'high' four data pins, not the 'low' four.
Best Wishes |
|
|
deniska_gus
Joined: 11 Jul 2006 Posts: 42 Location: Minden, Germany
|
|
Posted: Thu Oct 05, 2006 3:36 am |
|
|
Thank you, Ttelmah, i have change it but it doesn't work. I have to say, i used the search function of this forum and i have added all i need to my plan( 10K trimpot etc.). I use 2X16 LCD Display with HD 44780 Controller. All i can see is just black line. |
|
|
Ttelmah Guest
|
|
Posted: Thu Oct 05, 2006 5:23 am |
|
|
A single black line in the top half of the display, means it is not being initialised, which comes back to the connections. Triple check. The pinouts of displays differ, and even sometimes the pin names.
Best Wishes |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Thu Oct 05, 2006 7:54 am |
|
|
And even sometimes the timming.
Someone else posted and little test. In the code, if there is a
delay set after reading/writeing pins, try doubling the time.
See if that helps. |
|
|
deniska_gus
Joined: 11 Jul 2006 Posts: 42 Location: Minden, Germany
|
|
Posted: Thu Oct 05, 2006 8:08 am |
|
|
I'll try this. Thank you , guys.
Regards. Dennis.
P.S. If someone has any idea, so please write it. I have nobody else, who could help me. |
|
|
Ttelmah Guest
|
|
Posted: Thu Oct 05, 2006 8:15 am |
|
|
Also, try inserting a delay _before_ starting lcd_init.
Many of the LCD's, require several mSec after 'power on', before they are ready to accept commands. For example, for Hitach chips, they say 'wait for at least 15mSec after power rises above 4.5v'.
Best Wishes |
|
|
Markdem
Joined: 24 Jun 2005 Posts: 206
|
|
Posted: Thu Oct 05, 2006 4:56 pm |
|
|
One more thing you can try is putting a delay_ms(250); after the lcd_init() line. I have seen LCD that need a bit of time to get up and running.
Also, when you say all you can see is black line, is it only the top line, or is it the full screen?? If it is the full screen, just try to adjust the trim pot.
Have fun
Mark |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Thu Oct 05, 2006 6:29 pm |
|
|
Where are the pinouts to the LCD interface defined? Such as enable, write.. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
deniska_gus
Joined: 11 Jul 2006 Posts: 42 Location: Minden, Germany
|
|
Posted: Thu Oct 05, 2006 11:06 pm |
|
|
to Markdem:
It is just the top line. I'll try delay_ms(250). Thank you.
to Asmallri
The Pinouts to the LCD interface are defined:
D0 -> enable (pin 6 LCD)
D1 ->RS (pin 4 LCD)
D2 ->RW (pin 5 LCD)
D4 -> D4 (pin 11 LCD)
D5 -> D5 (pin 12)
D6 -> D6 (pin 13)
D7 -> D7( pin 14)
Thank you |
|
|
|