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: }