Arduino: Code for testing HD44780 LCD

Post Reply
tong
Site Admin
Posts: 2386
Joined: Fri 01 May 2009 8:55 pm

Arduino: Code for testing HD44780 LCD

Post by tong »



Download the latest F. Malpartida's New LiquidCrystal Library below:
https://bitbucket.org/fmalpartida/new-l ... /downloads

Code: Select all

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

void setup()
{
  byte customChar0[8] = {31,00,31,00,31,00,31,0};
  byte customChar1[8] = {14,27,27,31,27,27,27,0};
  byte customChar2[8] = {30,27,27,30,27,27,30,0};
  byte customChar3[8] = {14,27,24,24,24,27,14,0};
  byte customChar4[8] = {30,27,27,27,27,27,30,0};
  byte customChar5[8] = {31,24,24,30,24,24,31,0};
  byte customChar6[8] = {31,24,24,30,24,24,24,0};
  byte customChar7[8] = {14,27,24,27,27,25,15,0};

  lcd.begin(20,4);
  lcd.createChar(0,customChar0);
  lcd.createChar(1,customChar1);
  lcd.createChar(2,customChar2);
  lcd.createChar(3,customChar3);
  lcd.createChar(4,customChar4);
  lcd.createChar(5,customChar5);
  lcd.createChar(6,customChar6);
  lcd.createChar(7,customChar7);
}

void loop() 
{
  lcd.clear();
  //lcd.print("\x08\x01\x02\x03\x04\x05\x06\x07 \x08\x09\x0A\x0B\x0C\x0D\x0E\x0F");
  //delay(20000);
  
  for(int i=0; i<=3; i++)
  for(int j=0; j<=19; j++)
  {
    lcd.setCursor(j,i);
    lcd.write(byte(255));
    delay(100);
  }
  lcd.noDisplay();
  delay(200);
  lcd.display();
  delay(10000);

  for(int i=1; i<=3; i++)
  {
    lcd.noBacklight();
    delay(200);
    lcd.backlight();
    delay(200);
  }

  int k = 0;
  for(int r=1; r<=4; r++) 
  {
    lcd.clear();
    for(int i=0; i<=3; i++)
    {
      lcd.setCursor(0,i);
      lcd.write(byte(0)); delay(100);
      lcd.write(byte(0)); delay(100);
      for(int j=0; j<=15; j++)
      {
        lcd.write(byte(k)); k++;
        delay(100);
      }
      lcd.write(byte(0)); delay(100);
      lcd.write(byte(0)); delay(100);
    }
    lcd.noDisplay();
    delay(200);
    lcd.display();
    delay(10000);
  }
}
tong
Site Admin
Posts: 2386
Joined: Fri 01 May 2009 8:55 pm

Re: Arduino: Code for testing HD44780 LCD

Post by tong »

01.jpg 02.jpg 03.jpg 04.jpg 05.jpg
tong
Site Admin
Posts: 2386
Joined: Fri 01 May 2009 8:55 pm

Re: Arduino: Code for testing HD44780 LCD

Post by tong »

HD44780 have two ROM code, A00 and A02.
HD44780-17.jpg HD44780-18.jpg
Post Reply