简体   繁体   中英

LCD not displaying character using Arduino Uno

As it mention in the title, LCD is not displaying String it is displaying weird character. Here is the code:

#include <LiquidCrystal.h>

LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

void setup() {
  lcd.begin(16, 2);
   Serial.begin(9600);
   lcd.print("hello, world!");

}

void loop() {
    lcd.setCursor(0, 1);
    lcd.print(millis()/500); 
}

and here is what the LCD diplays:

See image 在此处输入图片说明

This can have several reasons:

  • the display hardware is broken (but i don't think so, its showing something, but wrong characters)
  • the connections from arduino to the display are wrong
  • at least one connection cable is broken (these small cables break very often at the connector ...)

It's also possible that you drive the display in wrong mode. The data connections can be half-bytes (4 bits) or bytes (8 bits) at once, ie you connect either 4 or 8 data cables. The driver must then set the correct mode, else the communication doesn't work correctly (ie if you set 8 bit mode and connect 4 cables, the upper 4 bits will have either random or 0 values).

Please check the hardware connections.

您似乎正在使用16x2显示器,即使您是特殊字符也应该能够显示,这是您在硬件中设置错误的原因

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM