This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP-EXP430F5529LP: LCD not working in 4 bit mode with Energia

Part Number: MSP-EXP430F5529LP
Other Parts Discussed in Thread: ENERGIA

Hello,

I am interfacing 16x2 LCD with model number 'JHD162A' with MSP4305529 Launchpad. I am using Energia environment for the developement. I face a weired issue with LCD. The LCD works  perfectly in 8 bit mode but when I Connect it into 4-bit mode it displays garbage value.  

My Pin configuration is as following,

For 8 bit mode:

RS:  P2.5

RW:  P2.4

EN:  P1.5

D0:  P2,0

D1:  P7.4

D2:  P2.6

D3:  P2.3

D4:  P8.1

D5:  P8.2

D6:  P3.7

D7:  P3.6

For 4 bit mode:

RS:  P2.0

RW:  P7.4

EN:  P2.6

D0:  NC

D1:  NC

D2:  NC

D3:  NC

D4:  P8.1

D5:  P8.2

D6:  P3.7

D7:  P3.6

The code I have used is given bellow.

#include <LiquidCrystal.h>

#define RS    P2_0  
#define RW    P7_4
#define EN    P2_6
#define D4    P8_1
#define D5    P8_2
#define D6    P3_7
#define D7    P3_6

//LiquidCrystal lcd(P2_5, P2_4, P1_5, P2_0, P7_4, P2_6, P2_3, P8_1, P8_2, P3_7, P3_6); //8-bit mode
LiquidCrystal lcd(RS,RW,EN,D4, D5, D6, D7);//4bit mode
void setup() {
  
  
  // put your setup code here, to run once:
  lcd.begin(16,2);
  lcd.write("Hello World");
  lcd.setCursor(0,1);
  lcd.print("from Earth");
  

}

void loop() {
  // put your main code here, to run repeatedly: 
  
}

  • Hi Shreyas,

    Sorry, I am not familiar with Energia environment. But the hardware setting seem correct.

    I think it may be relevant to the difference between 4-bit and 8-bit operation. In the source code, I don't know how you connect with LCD by lcd.write(), but I think it should be different from 8-bit mode. Please refer to LCD user's guide and find whether it should change the communication logic between MCU and LCD driver.

    B.R.

    Sal

  • I will check the datashet with reference lcd.write() function as suggested by you. and Thanks for the reply.

**Attention** This is a public forum