strange lcd problem

Started by e9310007 May 29, 2005
Hello all,

I have a strange problem and in fact I am getting crazy about it.I am
almost new to the PIC programming however I have to work hard in a
short while.I am ok with the I/O ports, ADC, Picc commands and etc.
but when it came to the lcd output, nothing worked. Hope someone can
help me about it.

I have a 2*16 Hitachi 44780 controller LCD (LM016L) and I am using
PIC 16F877, 4 MHz crystal source and a 5 V power supply.I set up a
small circuit in order to test lcd. The schematic is here:

http://rapidshare.de/files/2054592/lcd.JPG.html

My code is the following:

#include pic.h //(i could not put pic.h in brackets here, when
posting to the forum,don't know why but pic.h in brackets literally)

#include delay.c //(delay.c in brackets literally)

#include lcd.c // (lcd.c in brackets literally)

main(void)
{

TRISA=0;
TRISB=0;
lcd_init();
lcd_clear();
lcd_puts("HELLO");

for(;;)
{

}
}

All of the header and source files (pic.h, delay.c, lcd.c) are from
the include&samples directory of Hi Tech Picc Compiler (V 8.02 PL1)
and nothing has been changed.I have used both MPLab integrated
compiler and the distinct compiler and got the hex file without any
error.When I load it to the PIC via my programmer, I chose
"Watchdog
Timer" disabled and "Oscillator Type" as XT (crystal).
Finally, All I
see on the LCD panel is that the dots of all characters of upper row
is turning grey and no text on the screen.When I adjust the pot
value, contrast is changing but I don't see any "Hello".

My oscillator, my power source and my PIC are ok because I have
tested all in a LED circuit.
As a solution, I have tried "Full Optimization" when I am
compiling
via Command Line Picc Compiler and chose "1" as global
Optimization
Level but nothing changed.I haven't changed any settings of
optimization in MpLab integration.

What am I missing???

I am looking forward to hearing from you.Thanks in advance...