Pages: [1] 2 3 4   Go Down
Author Topic: LCD does not work unless Arduino is reset.  (Read 5724 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Tesla Member
***
Karma: 72
Posts: 7171
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17261
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Tesla Member
***
Karma: 72
Posts: 7171
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Alright. I'll let the other guy know too.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Newbie
*
Karma: 0
Posts: 25
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Sr. Member
****
Karma: 1
Posts: 323
Made it mahself outta sand 'n wahr.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Tesla Member
***
Karma: 72
Posts: 7171
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Sr. Member
****
Karma: 1
Posts: 323
Made it mahself outta sand 'n wahr.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
God Member
*****
Karma: 5
Posts: 581
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

still got the problem with mine, delay does not seem to help, I've even tried up too 10 seconds
Logged

Minnesota USA
Offline Offline
Sr. Member
****
Karma: 1
Posts: 323
Made it mahself outta sand 'n wahr.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Where can I buy one just like it? model number etc.

Logged

South UK
Offline Offline
God Member
*****
Karma: 5
Posts: 581
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
God Member
*****
Karma: 5
Posts: 581
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

well two of my screens are now on their way to mr Raines for testing.

I have also purchased 2 other screens and they act exactly the same smiley-sad

they are..

http://www.ebay.co.uk/itm/160633652459?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649#ht_3834wt_957
http://www.ebay.co.uk/itm/190345879489?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649#ht_3812wt_906
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 223
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Pages: [1] 2 3 4   Go Up
Jump to: