Jump to content
43oh

16x2 LCD display hello code is not working with MSP430F5529


Recommended Posts

this is the code i am using:

 

 

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(P2_0, P1_2, P2_2, P2_3, P2_4, P2_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);
}

 and this is the connections:

 

 The circuit:
 =================================
 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 (P1.2)
 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
 =================================

Link to post
Share on other sites

What's the voltage of the 16x2 screen?

 

If it is 5V-powered, as most cheap text screens are, it can't work with the 3.3V-based LaunchPad.

 

Why?

  • The high signal sent by the LaunchPad is too low to be considered as high by the screen. 
  • Worse, if the screen sends signals back, the high is too high and may damage the LaunchPad.

 

The solution consists on a logic level converter... or on a 3.3V-friendly screen.

 

Try the Nokia 5110 or 7110 screens: they are affordable and the libraries are widely available, including for Energia.

Link to post
Share on other sites

I've used several of these cheap 5v text lcd's and have never had a drama driving them with 3.3V logic. If your connection diagrams from above are accurate, you have problems with your code or connections. On the 5529, pins 8, 9,10,11,12 & 13 equate to P2_7, P4_2, P4_1, P8_1, P2_3 & P2_6 respectively, not P2_0, P1_2, P2_2, P2_3, P2_4 & P2_5 as your code indicates. Your pin naming is almost accurate for the G2 launchpad (2452, 2553), however pin 9 is P2_1, not P1_2.  I'm confident that once you correct your pin connections / pin naming in code, that the LCD will leap into life.  Unless you are really unlucky, the 3.3V logic of the 5529 Launchpad or the 3.6V logic of the G2 Launchpad shouldn't matter at all.

Link to post
Share on other sites

The 3.3V to 5V logic level converter has been debated many times in this very forum.

 

See a full review at http://embeddedcomputing.weebly.com/isup2c-logic-level-converter.html

 

For the screens, have a look at the 43oh shop. There are excellent B&W and colors screens that fit on the LaunchPads. 

 

May I suggest you to use a laptop with a larger screen than the ST26i :)

 

Welcome to 43oh forums. Searching for answers is part of the game! 

Link to post
Share on other sites

I've used several of these cheap 5v text lcd's and have never had a drama driving them with 3.3V logic. If your connection diagrams from above are accurate, you have problems with your code or connections. On the 5529, pins 8, 9,10,11,12 & 13 equate to P2_7, P4_2, P4_1, P8_1, P2_3 & P2_6 respectively, not P2_0, P1_2, P2_2, P2_3, P2_4 & P2_5 as your code indicates. Your pin naming is almost accurate for the G2 launchpad (2452, 2553), however pin 9 is P2_1, not P1_2. I'm confident that once you correct your pin connections / pin naming in code, that the LCD will leap into life. Unless you are really unlucky, the 3.3V logic of the 5529 Launchpad or the 3.6V logic of the G2 Launchpad shouldn't matter at all.

 

My code is correct i also check this code in msp430g2 launchpad.check your LCD.

 

Link to post
Share on other sites

My code is correct i also check this code in msp430g2 launchpad.check your LCD.

If your code is correct, then what you have indicated in your connection diagram is wrong.  In your first post, you indicate that the LCD's EN is connected to pin 9 then you put in brackets (P1_2). In your sample code, you call LiquidCrystal with P1_2 as the parameter for the enable pin.  BUT - pin 9 on the G2 launchpad is P2_1, not P1_2, so you need to call LiquidCrystal(P2_0, P2_1, P2_2, P2_3, P2_4, P2_5); (I have put the change in bold).

 

If you are using the 5529 launchpad, as per your 2nd post, Pins 8-13 have completely different names, so you would need to call LiquidCrystal(P2_7, P4_2, P4_1, P8_1, P2_3, P2_6);

 

As I said before, I've used many of these cheap 5V text LCD's, from multiple suppliers, in multiple screen sizes, and have never had a problem running them from 3.3v logic. So unless you are extremely unlucky, I very much doubt the 3.3v logic is your problem.  The more likely source of your problem is the use of the wrong pin names that you have indicated in your original post.

Link to post
Share on other sites

If your code is correct, then what you have indicated in your connection diagram is wrong. In your first post, you indicate that the LCD's EN is connected to pin 9 then you put in brackets (P1_2). In your sample code, you call LiquidCrystal with P1_2 as the parameter for the enable pin. BUT - pin 9 on the G2 launchpad is P2_1, not P1_2, so you need to call LiquidCrystal(P2_0, P2_1, P2_2, P2_3, P2_4, P2_5); (I have put the change in bold).

 

If you are using the 5529 launchpad, as per your 2nd post, Pins 8-13 have completely different names, so you would need to call LiquidCrystal(P2_7, P4_2, P4_1, P8_1, P2_3, P2_6);

 

As I said before, I've used many of these cheap 5V text LCD's, from multiple suppliers, in multiple screen sizes, and have never had a problem running them from 3.3v logic. So unless you are extremely unlucky, I very much doubt the 3.3v logic is your problem. The more likely source of your problem is the use of the wrong pin names that you have indicated in your original post.

Yes you are Wright i change my code and now it's working properly .thanks guys for helping me.....

 

Sent from my ST26i using Tapatalk

 

 

Link to post
Share on other sites

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...