Btw. here is a picture of my cfg.
Switch OFF LVP and BOR (brown-out-reset). If does not help, send your full code, i'll try to simulate it.
Btw, do you use 8 or 4-bit interface to LCD?
PS. Are you sure your code worked and that you ported it correctly? Type of LCD is also interesting.
PS/1. X-tal must be placed right next to uP, no wires!
LVP & BOR off, now it is only the cursor that blinks in the start of the line, no letters, I have my x-tal next to the uP no caps, I use 4 bit connection, with the RW pin grounded (thats why the initialize delay is 100, I did that for decreasing the number of pins used on my old PIC). Well, the display uses a normal 44780 controller it has the normal japaneese signs in the end of the ASCII table replaced with kyrillic letters, since I bought the LCD in Russia, there are really not much more about the display. Btw. I noticed, that when I short the x-tal pins with my finger, the text gets on it's right place, but as soon as I remove my finger it gets back to the blinking at the start of line 1.
Here is my full code and the LCD library (not mine, I only edited it).
Haa, this might explain everything! What's your clock freq.? Too high possibly. Anyway, I'll take a look at the code now.Originally Posted by Russian
Did you know that sub delay100 actually delays only 1,4 ms!!! ? Otherwise code works OK (on PIC18F452). You must add delays:
- before initializing LCD, about 100mS (use MPLAB-s simulator to check time)
- delay about 2mS after sending cmd or data to LCD (in the lib file)
See code.
Last edited by Felch; - 29th August 2005 at 18:07.
Sorry, but i have never tried to use MPLAB so I don't know how to use the simulator =( But, that delay, you added in the end of the LCD.lib file, there stands that it is written for an 11,0592MHz clock how should I handle that? Anway, I tried to compile the program and run it, well there stands a 0 in the end of line1 and there stands something wird in the end of line 2...And, btw. how do I make that 100mS delay before init (I am a almost total lost, especially when things don't work)? Just add a loop that takes your routine 100 times?
Thanks for great responding!!!
Hi!
MPLAB is a great simulator for checking loop execution times and so on. It has it's bad sides also but i guess not here.
Anyway, i wanted to point out that if your xtal freq.=4MHz (usual), your 100mS delay loop actually delays much less, abot 1,4 mS!!! This will most probably explain veird LCD behaviour since it's a relatively slow device. Datasheets indicate that user should poll the BUSY flag before sending any kind of data to screen. In practice, it is rearely done, usually one would simply wait long enough to be at the safe side and then send another data/cmd byte.
So i added a routine that would delay some time at mentioned crystal freq. If your clock is slower then it simply takes some more time and that's all. Everything should work. It it's faster, you must add delay time.
I can not possibly comment 0-s or other chars at end of lines since i am not familiar with your enviroment. Still i hope you got the general idea (make it slower or poll busy flag).
Btw, what is your xtal frequency and what about your programming language?
Does it really have no means for measuring loop times?
Drop me a mail if anything remains unclear
/Felch
Bookmarks