Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Interfacing with LCD
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Interfacing with LCD

by peck on Wed Apr 15, 2009 9:43 pm

Ok, kind of a continuation of this thread, viewtopic.php?f=8&t=10646, but figured its arduino specific to put up here.

Currently have it hooked up (a few times now!), and I cannot seem to make it work. The LCD seems to be at least getting power, as I can see the full black squares at the bottom. Cannot figure out for the life of me why its not working.

Just using the example sketch, only changing the pins.

Code: Select all | TOGGLE FULL SIZE
#include <LiquidCrystal.h>

// LiquidCrystal display with:
// rs on pin 12
// rw on pin 11
// enable on pin 10
// d4, d5, d6, d7 on pins 5, 4, 3, 2
LiquidCrystal lcd(7, 13, 8, 9, 10, 11, 12);

void setup()
{
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop()
{
}


And an image to in case someone sees a problem.
http://twitpic.com/3dqom
Thanks for any help!
peck
 
Posts: 17
Joined: Sat Mar 28, 2009 7:03 pm

Re: Interfacing with LCD

by peck on Wed Apr 15, 2009 9:52 pm

Ok, so it does work, but only after I press the reset button. Is there a reason why this is?

Thanks,
peck
 
Posts: 17
Joined: Sat Mar 28, 2009 7:03 pm

Re: Interfacing with LCD

by atomicjello on Thu Apr 16, 2009 1:51 am

When the Arduino starts up, it runs whatever is in the setup() once and only once. It is there to run code that must run one time - usually used to set things up.

After running setup(), the loop() function is called again and again (looping!).

The program did your lcd print (which you saw after rebooting), then repeated doing nothing since you have nothing in your loop() function.
atomicjello
 
Posts: 3
Joined: Mon Apr 13, 2009 4:36 pm
Location: Ladera Ranch, CA

Re: Interfacing with LCD

by floresta on Wed Apr 22, 2009 8:18 pm

atomicjello:
... since you have nothing in your loop() function.
Your answer is correct as far as it concerns the Arduino. You didn't answer his LCD question. What would you have him put in the loop(), and why?

peck:
The answer to your question is that the LiquidCrystal library, in my opinion, does not follow the manufacturer's recommendations for initializing the LCD module. Therefore it does not work reliably on every module although it may work reliably on some modules. I have a link to an explanation and a solution here: http://web.alfredstate.edu/weimandn.

floresta

floresta
 
Posts: 223
Joined: Thu Jul 31, 2008 10:27 am
Location: Western New York, USA

Re: Interfacing with LCD

by eil on Wed May 06, 2009 4:00 am

Cool! I've been tinkering with an LCD display connected to a boardino and found that it would only initialize and start working about 50% of the time from power on. This improved LiquidCrystal library sounds like it would solve that. I'll have to check it out!
eil
 
Posts: 440
Joined: Sun Aug 31, 2008 11:09 pm

Please be positive and constructive with your questions and comments.