Author Topic: NHD-0420E2Z-NSW-BBW is displaying Japanese Characters instead of my string  (Read 4960 times)

shaneyost

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
    • View Profile
I'm trying to display the string "ABCD" for starters on this LCD NHD-0420E2Z-NSW-BBW. However, the LCD displays Japanese related characters. Instead of creating another discussion for the 5th time and i'm going to point you to the link where one of my discussions is located. You will find pictures, code and even the data sheet to my LCD. Any ideas on how to fix this. It seems it is getting the upper 4 bits wrong in the data byte. I checked my wiring and from what i can tell everything is wired correctly. My arduino code is the only thing that I can think of that could be causing this issue. However, now i'm wondering if my wiring is wrong somewhere. Please refer to the following link.

http://stackoverflow.com/questions/23999145/lcd-outputs-chinese-characters-instead-of-alphanumeric

Michael_L

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 33
    • View Profile
Hi Shane,

Did you receive my response to your email yesterday regarding this?  I will copy it and post it below just in case you did not:

That Arduino library is written for Hitachi HD44780 controller, whereas our display uses the Sitronix ST7066U.  There are some minor timing differences between the two controllers, which can be seen in their respective datasheets. However, I have used this library with our displays before, but I believe it was using an 8-bit interface.  The problem here is not our display but in fact the library you are using.  If it’s possible, try using an 8-bit interface with that library, otherwise you may refer to the attached 4-bit interface Arduino code I have for our 4x20 character displays.

Note:  in the code you will see it mentions “character OLED” display, but the code works for our LCDs as well (I just tested it again to be sure).

Code: [Select]
//---------------------------------------------------------
/*
NHD_0420DZW_mega.ino
Program for writing to Newhaven Display 4 x 20 Character OLED (4-bit, 6800 mode)

(c)2014 Michael D. LaVine - Newhaven Display International, LLC.

        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 2 of the License, or
        (at your option) any later version.

        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
*/
//---------------------------------------------------------

// The 4 bit data bus is connected to PORTD[3..0] of the Arduino Uno

int RS =  9;     // RS signal connected to digital pin 9
int RW =  10;    // R/W signal connected to digital pin 10
int  E =  11;    // E signal connected to digital pin 11

const char text1[] = {"  Newhaven Display  "};
const char text2[] = {"   Character OLED   "};
const char text3[] = {"  4 Line x 20 Char  "};
const char text4[] = {"0123456789!@#$%^&*()"};

void toggle()
{
   digitalWrite(E, HIGH);
   delay(1);
   digitalWrite(E, LOW);
}

void command(char c)

   PORTD = (c>>4);
   digitalWrite(RS, LOW);
   toggle();
   PORTD = c;
   toggle();
}

void data(char d)
{
   PORTD = (d>>4);
   digitalWrite(RS, HIGH);
   toggle();
   PORTD = d;
   toggle();
}

void disp()
{
   int i;
   delay(50);
   command(0x02);  //Home Command  [Set DDRAM address to Line 1 position 1]
   delay(5);
   for (i=0;i<20;i++)
   {
      data(text1[i]);
   }
   command(0xC0);  //Second Line  [Set DDRAM address to Line 2 position 1]
   for (i=0;i<20;i++)
   {
      data(text2[i]);
   }
   command(0x94);  //Third Line  [Set DDRAM address to Line 3 position 1]
   for (i=0;i<20;i++)
   {
      data(text3[i]);
   }
   command(0xD4);  //Fourth Line  [Set DDRAM address to Line 4 position 1]
   for (i=0;i<20;i++)
   {
      data(text4[i]);
   }
}

void setup()
{
   DDRD = 0xFF;    //set PORTD (data bus) as output
   PORTD = 0x00;   //initialize PORTD to 0x00
   DDRB = 0xFF;    //set PORTB (control lines) as output
   PORTB = 0x00;   //initialize PORTB to 0x00
   delay(5);
   toggle();
   delay(5);
   PORTD = 0x2;
   toggle();
   command(0x28);
   PORTD = 0x0;
   toggle();
   PORTD = 0x8;
   toggle();
   PORTD = 0x0;
   toggle();
   PORTD = 0x1;
   toggle();
   delay(5);
   PORTD = 0x0;
   toggle();
   PORTD = 0x6;
   toggle();
   PORTD = 0x0;
   toggle();
   PORTD = 0x2;
   toggle();
   PORTD = 0x0;
   toggle();
   PORTD = 0xC;
   toggle();
   delay(10);
}

void loop()

  disp();
  delay(3000);
}

 

Character LCD NHD‐0220D3Z‐NSW‐BBW‐V3 not receiving correct characters

Started by davekBoard Character LCDs

Replies: 1
Views: 2356
Last post March 25, 2016, 05:23:05 PM
by Saurabh_B
NHD‐240128WG‐BTFH‐VZ - custom characters

Started by saubaerBoard Graphic LCDs

Replies: 1
Views: 1235
Last post November 11, 2016, 12:09:42 PM
by Saurabh_B
NHD-2.7-12864UCY3 yellow columns occur under ascii characters

Started by bsoyerBoard OLEDs

Replies: 7
Views: 4328
Last post August 26, 2015, 11:02:25 AM
by tracyb
NHD-C0220BiZ-FSW-FBW-3V3M NAKs all odd numberd ASCII characters

Started by majorninthBoard Character LCDs

Replies: 7
Views: 3980
Last post May 28, 2015, 04:51:31 PM
by Michael_L
NHD-0420D3Z-NSW-BBW-V3 i2c display and Arduino missing characters

Started by 0miker0Board Character LCDs

Replies: 0
Views: 819
Last post July 06, 2017, 11:05:59 AM
by 0miker0