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:在带 Energia 的4位模式下 LCD 无法工作

Guru**** 2382630 points
Other Parts Discussed in Thread: ENERGIA
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1234156/msp-exp430f5529lp-lcd-not-working-in-4-bit-mode-with-energia

器件型号:MSP-EXP430F5529LP
Thread:Energia 中讨论的其他器件

您好!

我将16x2 LCD 与型号"JHD162A"与 MSP4305529 Launchpad 相连。 我使用 Energia 环境进行开发。 液晶屏出现问题。 LCD 在8位模式下运行良好、但当我将它连接到4位模式时、它会显示垃圾值。   

我的引脚配置如下所示、

对于8位模式:

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

对于4位模式:

RS: P2.0

RW: P7.4

英文: P2.6

D0: NC

D1: 常闭

D2: 常闭

D3: 常闭

D4: P8.1

D5: P8.2

D6: P3.7

D7: P3.6

下面给出了我使用的代码。

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

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Shreyas:

    抱歉、我不熟悉  Energia 环境。 但硬件设置似乎正确。

    我认为这可能与4位和8位操作之间的差异有关。 在源代码中,我不知道你如何通过 LCD.write ()连接 LCD ,但我认为它应该不同于8位模式。 请参阅 LCD 用户指南、确定它是否应更改 MCU 和 LCD 驱动器之间的通信逻辑。

    B.R.

    Sal.

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我将检查数据集与参考 LCD.write()函数由你建议。 感谢您的回复。