Jump to content
43oh

LiquidCrystal + LCD problem


Recommended Posts

I'm using a Rev1.5 LaunchPad with a G2553, and trying to get a standard 3.3V 16x2 LCD to work in 4-bit parallel mode. I'm using the classic example HelloWorld code. I grabbed it from Energia / hardware / msp430 / libraries / LiquidCrystal along with LiquidCrystal.h and LiquidCrystal.cpp, included them with #include, and everything compiles and loads fine. The LCD is wired with the Arduino-style pin numbers that HelloWorld expects.

 

The problem is that it just doesn't work. There's no sign of activity on the LCD. I substituted a 5V LCD on the breadboard and hooked the breadboard to an Arduino Uno. That works fine, no problem.

 

I'm not the only one in this state - my friend/co-worker Clive has the same problem. I'm not sure what LaunchPad version he has. My 3.3V LCD is brand new from SparkFun. The backlight works fine, but I have no other 3.3V system to test it the display functions. It could be broken, but pilot error is a lot more likely.

 

Can someone point out where I messed up?

 

Randy

Link to post
Share on other sites

Hi Randy,

 

I remember I also had some problems using a 3V3 LCD.

Especially adjusting the contrast was very tricky.

 

So I decided to use a 5V type.

 

In the meantime I tried several displays and all worked well with the 3V5-logic of the lauchpad.

If you do not read from the LCD (R/W wired to GND), you only need six output pins and no input can endanger the MSP chip.

 

The 5V can be found at TP1 near the USB connector.

 

Just to be safe, you can insert a diode in the 5V line to lower the voltage by 0.7V.

All 5V displays run at 4.3V (4.3oh;-) and then a high level of 3.5V is more than enough.

 

And another tip: Especially in the Arduino environment I often saw the data pins DB0..DB3 on the LCD left open.

For 4-bit mode, these pins should be connected to GND!

 

 

=================================
Pinout for a 5V LCD to Lauchpad
+5V can be found at TP1
(near USB) on the Lauchpad
=================================
LCD pin              Connect to
---------------------------------
01 - GND             GND, pot
02 - VCC             +5V, pot
03 - Contrast        Pot wiper
04 - RS              Pin8 (P2.0)
05 - R/W             GND
06 - EN              Pin9 (P2.1)
07 - DB0             GND
08 - DB1             GND
09 - DB2             GND
10 - DB3             GND
11 - DB4             Pin10 (P2.2)
12 - DB5             Pin11 (P2.3)
13 - DB6             Pin12 (P2.4)
14 - DB7             Pin13 (P2.5)
15 - BL+             +5V
16 - BL-             GND
=================================

 

The pinout above is from a (very basic) LCD lib I wrote from scratch.

The standard libs have so much overhead I never use. And I wanted something simple to test timings etc.

If you want to try, I can post it here.

 

Good luck

Michael

 

P.S.: I have to use the account of my neighbor (my co-) to post.

I registered some time ago, but the account is blocked for posting.

Link to post
Share on other sites

#Now with my own account#

 

Hi Robert,

 

I took the lib from energia-0005a\libraries\LiquidCrystal and tried a little bit.

(using 0101E0006 of course)

 

To make it run, remove the line "begin(16, 2)" from LiquidCrystal::init.

Make a call "begin(16, 2, 0)" in you sketch instead.

But please don't ask me why ;-)

 

Of course "#include " must be replaced by "#include ".

 

The output is very slow, because data direction is set on every bit setting.

So add this to LiquidCrystal::init

 if (_displayfunction & LCD_8BITMODE) {
   for (uint8_t i=0; i<8; i++) pinMode(_data_pins[i], OUTPUT);
 } else {
   for (uint8_t i=0; i<4; i++) pinMode(_data_pins[i], OUTPUT);
 }

and remove

pinMode(_data_pins, OUTPUT);

from LiquidCrystal::write4bits and LiquidCrystal::write8bits

 

Michael

 

Edit: I only tested it with "HelloWorld".

Link to post
Share on other sites

Thanks, Michael! I tried the changes and HelloWorld and the others I tested work well. Because of the flakiness of software serial I didn't try the two examples (SerialDisplay and TextDirection) that use it. CustomCharacter failed to compile with a problem I didn't have time to track down.

 

I used a Sparkfun 3.3V display for the tests, and also tried a Wintek OLED display from Adafruit. The OLED display works fine (it also works on 5V), but a reset causes it to display garbage. It requires a hard start -- a known problem that Adafruit is looking into.

 

Randy

Link to post
Share on other sites
  • 3 months later...

Hi all

 

I just have a problem with a LiquidCrystal example.

I connected a 3.3V 16x2 lcd display to lauchpad with a MSP430g2452 and everything seems ok (remember to ground the unused Dx pins of display!), all examples have worked well but with CustomCharacters I have a compiler error:

 

CustomCharacter.cpp: In function 'void setup()':

CustomCharacter.cpp:124:14: error: call of overloaded 'write(int)' is ambiguous

CustomCharacter.cpp:124:14: note: candidates are:

D:\energia-0101E0008\hardware\msp430\libraries\LiquidCrystal/LiquidCrystal.h:82:18: note: virtual size_t LiquidCrystal::write(uint8_t)

D:\energia-0101E0008\hardware\msp430\cores\msp430/Print.h:56:12: note: size_t Print::write(const char*)

 

Any ideas ?

Link to post
Share on other sites
Hi all

 

I just have a problem with a LiquidCrystal example.

I connected a 3.3V 16x2 lcd display to lauchpad with a MSP430g2452 and everything seems ok (remember to ground the unused Dx pins of display!), all examples have worked well but with CustomCharacters I have a compiler error:

 

CustomCharacter.cpp: In function 'void setup()':

CustomCharacter.cpp:124:14: error: call of overloaded 'write(int)' is ambiguous

CustomCharacter.cpp:124:14: note: candidates are:

D:\energia-0101E0008\hardware\msp430\libraries\LiquidCrystal/LiquidCrystal.h:82:18: note: virtual size_t LiquidCrystal::write(uint8_t)

D:\energia-0101E0008\hardware\msp430\cores\msp430/Print.h:56:12: note: size_t Print::write(const char*)

 

Any ideas ?

 

Oooooppppssss !!!

 

Solved:

see in this forum the topic "Error with Liquid Crystal library..."

 

Anyway I had to put a delay before creating custom characters to have them correctly in my display ...

Link to post
Share on other sites
  • 1 month later...

Hello,

I try to make my 2x16 LCD work with msp430 rev.1.4.. LCD does not work with 5V so i tried with USB pin for 5V (it didn't work even with a diode connected to that pin)

I tried a different connection (because i have 14 pin MCU and so P2.0 P2.1, P2.2, P2.3, P2.4, P2.5 are empty. So i have used P1.5, P1.4,P1.3,P1.2,P1.1,P1.0 instead..

LiquidCrystal(RS,ENABLE,D4,D5,D6,D7) when i re-arrenge my pinouts according to the function i get nothing.

P.S.The "Hello World" example has been loaded to 430 succesfuly

P.S.2 i haven't tried Micheal's method yet:

P.S.3: I am really stucked with this LCD :/ i want to proceed on my Light Alarm project ^_^ So any help is very appreciated.

here is my code:

 

 

// include the library code:

#include <LiquidCrystal.h>

 

// initialize the library with the numbers of the interface pins

//LiquidCrystal lcd(P2_0, P2_1, P2_2, P2_3, P2_4, P2_5);

LiquidCrystal lcd(P1_0, P1_1, P1_2, P1_3, P1_4, P1_5);

 

void setup() {

// set up the LCD's number of columns and rows:

lcd.begin(16, 2);

// Print a message to the LCD.

lcd.print("hello, world!");

}

 

void loop() {

// set the cursor to column 0, line 1

// (note: line 1 is the second row, since counting begins with 0):

lcd.setCursor(0, 1);

// print the number of seconds since reset:

lcd.print(millis()/1000);

}

Link to post
Share on other sites
  • 3 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...