Offline
Newbie
Karma: 0
Posts: 25
|
 |
« on: August 04, 2011, 04:30:56 pm » |
So I have an lcd display hooked up to my arduino (Pins 7-12) When I first boot up the arduino, the LCD displays the first line as blocks at about 50% contrast. Once I hit reset on the arduino, it works as expected. I have no idea what is wrong, any ideas?
|
|
|
|
|
Logged
|
|
|
|
|
Central MN, USA
Offline
Faraday Member
Karma: 35
Posts: 5915
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
|
 |
« Reply #1 on: August 04, 2011, 06:22:39 pm » |
I am replying partially because I eant this to appear on my updated posts list for easy track of this thread. I have seen several occasions of this problem lately and know no solutions yet.
could you post your code and pic of connection?
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Online
Brattain Member
Karma: 279
Posts: 15310
Measurement changes behavior
|
 |
« Reply #2 on: August 04, 2011, 06:45:54 pm » |
I seem to recall that many LCD display/controllers take a pretty long time to perform their powerup/reset function. Maybe try a simple easy experiment and use a delay(5000); as the very first statement in the void setup() function to make sure the lcd is really ready to accept commands.
Lefty
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 25
|
 |
« Reply #3 on: August 04, 2011, 10:33:15 pm » |
delay(5000); at the beginning of void setup() worked like a charm. While it still displays the block for the first couple of seconds, once my text initializes, it works fine.
|
|
|
|
|
Logged
|
|
|
|
|
Central MN, USA
Offline
Faraday Member
Karma: 35
Posts: 5915
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
|
 |
« Reply #4 on: August 04, 2011, 10:41:49 pm » |
Alright. I'll let the other guy know too.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 7
|
 |
« Reply #5 on: August 05, 2011, 03:45:32 pm » |
The LCD clock will be around 7Mhz, perhaps less, and needs half a dozen clocks to initialise. Asside from the power rail stabilizing at 5v (the arduino will probably run or spin up the oscillator from 3.3v already if you have a -V chip). Basically means waiting about 50ms will get you into the clear unless you have access to the actual shipset datasheet in which case you can bring the delay down. Alternative #2 is to use a R-C network of 100nf and a 10Kohm resistor to hold the LCD in reset for long enough. Option #3 is to tie your reset pin to the LCD, although not a bad plan, it will interfere with the downloader, hope these comments help.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 25
|
 |
« Reply #6 on: August 05, 2011, 04:15:55 pm » |
A little more information. When this happened, I had a button wired up to the reset pin. To have this work, you have to have the reset pin tied to a HIGH rail
|
|
|
|
|
Logged
|
|
|
|
|
Minnesota USA
Offline
Sr. Member
Karma: 0
Posts: 323
Made it mahself outta sand 'n wahr.
|
 |
« Reply #7 on: August 10, 2011, 09:17:01 pm » |
I am curious whether the LiquidCrystal routines I worked on (which have longer delays at startup than the one that is packaged with the standard Arduino package) will work for you without the 5 second delay. If it does not work, it would be helpful to me to purchase an LCD exactly like the one you have to fix the code. Currently the most finnicky LCD I have is one I bought from the local Axman surplus store. Anyway if you could try my code and see if it solves your problem without the 5 second delay I would appreciate it. http://code.google.com/p/liquidcrystal440/
|
|
|
|
|
Logged
|
|
|
|
|
Central MN, USA
Offline
Faraday Member
Karma: 35
Posts: 5915
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
|
 |
« Reply #8 on: August 10, 2011, 10:04:28 pm » |
I bet I have the same display (20X4 no back light) from Axeman store. I ended up not using it at all. It requires delay after every lcd command. I don't think the display is up to spec. There are still a box full of these displays in their main store.
|
|
|
|
|
Logged
|
|
|
|
|
Minnesota USA
Offline
Sr. Member
Karma: 0
Posts: 323
Made it mahself outta sand 'n wahr.
|
 |
« Reply #9 on: August 11, 2011, 05:29:33 am » |
The axman display I have does work with the versions of LiquidCrystal I have. I actually have 2 of those LCDs and they both seemed to have identical timing characteristics. One thing I have puzzled over without success is if there is a way to explore exactly what is going on with them by comparing the time it takes to write characters when I wait for the busy flag vs what it takes as a timed delay between characters. There is a big difference in throughput with the two methods. Using the busy flag comes considerably closer to what my other displays do, but is still slower. It seems to me that there may be some specific situation that is slow on these displays and it would be interesting to figure out what it is. Anyway if laptopman has a display that is worse than the axman display I would like use one to make my code even more bulletproof.
One thing I did not mention in my previous post is that if you switch to my code and use the rw line, it will test the display's busy flag and that will likely be more reliable. You certainly won't need extra delays after each character. The busy flag cannot be used for the initialization sequence called either by LiquidCrystal lcd(rs,rw,en,...) or begin(), however. The initialization sequence requires timed delays.
If I remember correctly even the axman display works faster testing the busy flag than the standard LIquidCrystal routine (which never tests the busy flag) will work with a 'good' display. I might be misremembering that. If Don has any insight into how to understand just how I could structure test or what to look for to understand what situation in a sequence of characters sent to the LCD is the slowest thing I would be interested. Maybe there is something that could be done to the non busy flag testing version of my code.
|
|
|
|
|
Logged
|
|
|
|
|
South UK
Offline
Sr. Member
Karma: 1
Posts: 479
|
 |
« Reply #10 on: August 12, 2011, 09:07:36 pm » |
still got the problem with mine, delay does not seem to help, I've even tried up too 10 seconds
|
|
|
|
|
Logged
|
|
|
|
|
Minnesota USA
Offline
Sr. Member
Karma: 0
Posts: 323
Made it mahself outta sand 'n wahr.
|
 |
« Reply #11 on: August 13, 2011, 10:26:54 am » |
Where can I buy one just like it? model number etc.
|
|
|
|
|
Logged
|
|
|
|
|
South UK
Offline
Sr. Member
Karma: 1
Posts: 479
|
 |
« Reply #12 on: August 15, 2011, 04:55:49 am » |
Where can I buy one just like it? model number etc.
I know that's not aimed for me, and I'm sorry to hijack but Id be happy to send you one of the screens that I'm having the same problem with if you cover say half the postage with me?
|
|
|
|
|
Logged
|
|
|
|
|
South UK
Offline
Sr. Member
Karma: 1
Posts: 479
|
 |
« Reply #13 on: September 02, 2011, 06:41:28 pm » |
|
|
|
|
|
Logged
|
|
|
|
|
United Kingdom
Offline
Faraday Member
Karma: 130
Posts: 4643
|
 |
« Reply #14 on: September 03, 2011, 05:43:14 am » |
Looking at the LiquidCrystal library source in Arduino-0022, I see that the LiquidCrystal constructor makes a call to begin(), which delays for 50ms and then sends commands to the LCD. So it is quite possible that the LCD is receiving commands before it is ready, if the supply voltage rises slowly at power up.
I suggest removing the begin() call from the LCD constructor. A call to begin() should be made in setup() anyway. If the LCD still doesn't work until the reset button is pressed, then Lefty's suggestion of inserting at delay in setup() before the begin() call should fix it.
|
|
|
|
|
Logged
|
Formal verification of safety-critical software, software development, and electronic design and prototyping. http://www.eschertech.com
|
|
|
|
|