I'm building a 20x4 LCD controller with a PIC16F877A and tested it with the following sample code from the CD to my EasyPIC3 dev. board written in mikroC. I connect the wires like on the EasyPIC3 dev. board (D7-D4 to RB7-RB4, E to RB3, RS to RB2 and all others to GND), but the only thing I get is some blocks on line 2 and 4. Any ideas...? I have tried to search for any "missing link" but all is clear.
Code:
char *text = "mikroElektronika";
void main() {
LCD_Init(&PORTB); // Initialize LCD connected to PORTB
LCD_Cmd(LCD_CLEAR); // Clear display
LCD_Cmd(LCD_CURSOR_OFF); // Turn cursor off
LCD_Out(1,1, text); // Print text to LCD, 2nd row, 1st column
Delay_ms(1000);
LCD_Out(2,6,"mikroE");
}//~!
Sounds like it's not being initialised, you get the two rows of blocks even without connecting to a micro-controller. Either it's connected wrongly, or your code isn't working - or both!.
Hi...the first time I played with an lcd...I went crazy because all
I got were black blocks. If your code and initialization is good
then try connecting a 10K pot or a 1K pot to +5 and ground.
Connect the wiper of the pot to the lcd's "contrast" voltage
input pin. Try adjusting the pot while looking at the black
boxes. On some LCD's I dont think you can leave the
contrast pin floating.
I have a contrast pot connected, so it might not be a simple problem. I know the LCD work - I have tried three of them, all showing the same. The problem is even more difficult to answer because the LCD on the dev. board shows the right thing, but it's on a 2x16 character. Maybe there are some init errors.
I can't quite recollect, but I do remember something about extended chip sets having different dd_ram addressing per line plus an extra E strobe line etc, I remember bumping into something similar years ago with the extended and cloned HD44780 based displays...Perhaps your problem lies with the additional E strobes or addressing dd_ram locations you were not expecting...My memory is letting me down here, I really can't remember what the final outcome was, but I know I solved the problem
Often a four line display is just a pair of two line displays added together - with an extra select line to choose which one you want to access - you need to check on your specific display.
That may be what I was trying to remember....hehe...old age never comes by itself
It's been so long since I used a 4 line module that I remember diddly squeek about them now, I favour the 2*20's mainly, and have just got too used to thinking nice, simple things about em