GAH!!! stupid LCD :)

Status
Not open for further replies.
some 4 line LCDs have 2 44780s and an E line for each one. Then you need to init both. I think they typically have one 44780 controlling lines 1 and 3 and then the other controlls 2 and 4. kind of odd and quirky but if you hide it behind library routines it doesn't hurt too much. lol
 
Here is the code I always use. It's for 8051 but it's the idea that matter. Translate it (error free) to PIC code and if it doesn't work you have a great chance that your problem is hardware related... ... ...over to the PIC guys overhere

You will find 2 subroutines and code for the main program. The "Delay" thing is a preset value for a counter in a 10ms based timer interrupt routine. This ISR decrement "Delay" when it's not zero.
Only after these routines you can use the Busy flag.
 

Attachments

  • InitialisationLCDModule.txt
    2.2 KB · Views: 182
Take a look at the datasheet you posted, only the 4*40character display has 2 E-lines. Since Dan use a 4*16char we don't have to worry about this.

But if you look to the addresses of a 4*16char LCD you will see that line 3 is a continuation of line 1.
If your LCD is not well initialized, the 44780 assumes it has to control only one line and only lines 1 and 3 on the LCD react with dark dots, something Dan already encountered.
 
^^doh! its in assembly. I'm trying to get this to work in C so it can mesh w/ the rest of my program. I did get it pretty much working using the assembly in Nigel's tutorials. i got real characters, etc and a counting number.

i'll try to translate your init sequence to C and see what happens. thanks
 
man, im about to throw this damn thing out the window. i just did the whole seiko power up sequence bit by bit. however whenever i run the ICD2 debugger and step through the sequence my lower bits never change!

they work exactly as they should when using the MPLAB SIM to debug.

i checked possible conflicts and the only thing that could override my TRISD settings is if the parallel slave port was on. This is enabled w/ TRISE<4> and i'm sure its set to 0! both debuggers show it as 0 (off).

gaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaah.
 
@Nigel: Or dump the PIC and use a 8051 based µP

@DanD: Don't forget to first open the window before throwing anything to it, you might get it back in your face
Can you share some code with us, maybe you just overlook something...
I can't help you on PIC hardware stuff since I never used one, but I can asure you that the code I posted works for all 8051 based projects I've made so far.
 
I wonder if something in your C startup and/or initialization is setting the port to input. can you read trisc? you did set TRISC to 0, right?

why not write a super simple program that just sets portc as output (tris it to 0), write some pattern (10101010) and use a DMM to check.
 
ohhhh man i n00bed all over myself.

all the libraries i copied over still had #include <lcd.h>.. im using a custom lcd.h so of course i needed "lcd.h"

it works now

well i can address different lines and write strings. setting certain commands and writing data arent working, but ill figure it out.

yes! thanks for all the help, guys
 
question about solution

hi,
excuse me but i'm still having the same problem now, can you please explain me what was the solution?
thankyou very much
 
Why not the datasheet

The solution, found on another forum, was to send the initialisation sequence 3 times at the beginning.

The solution, strictly speaking, is to follow the datasheet.

With all the LCD displays I worked up to now, THAT was the solution.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…