20x4 LCD troubleshooting

18 Jun 2010 . Edited: 18 Jun 2010

Hello,

I've been trying to get my 24x4 LCD (https://www.sparkfun.com/commerce/product_info.php?products_id=256) working over the past day. I'm not sure if i have my wiring/code incorrect or if i may have just gotten a bum LCD.

Here is a crude wiring diagram of what i have currently setup, i've used both 10k and 20k resistors with the same results.

 

I'm pulling the 5V from pin 39. I've run the following code with zero output from the LCD. It looks as if it might as well be off.

 

 

#include "mbed.h"
#include "TextLCD.h"

TextLCD lcd(p10, p12, p15, p16, p29, p30); // rs, e, d0-d3

int main() {
     lcd.printf("Hello World!\n");
}

 

#include "mbed.h"
#include "TextLCD.h"

TextLCD lcd(p10, p12, p15, p16, p29, p30, TextLCD::LCD20x4); // rs, e, d0-d3

int main() {
    lcd.printf("Hello World!\n");
}
Any ideas or suggestions would be great, thanks in advance for your help.
-Jorge
18 Jun 2010

Soooo.. on Sparkfun's site they have a pdf showing to use a range of 10-20k ohm resistors as the contrast adjust. Turns out those are far too high, i used a 10k and it works fine.

 

=)

18 Jun 2010

HD44780U based LCD's in 4 bit mode communicate on the upper data lines DB4..7 not DB0..3

So, reconnect as follows:

LCD Pin No.      Function      Connection

1                      Vss             0V

2                      Vdd            +5V

3                      Vo              Connect to 10K potentiometer center terminal, outer terminals to ground and +5V, this provides variable contrast control.

4                     RS               mbed P10

5                     RW              0V

6                     E                 mbed P12

7..10               DB0..DB3     Do not connect - not used in 4 bit mode

11                   DB4             mbed P15

12                   DB5             mbed P16

13                   DB6             mbed P29

14                   DB7             mbed P30

15                   LED+           If back-light used: +5V via 27R

16                   LED-            If back-light used: 0v

 

Hope that helps. Good luck!