Author Topic: NHD-0420D3Z-FL-GBW-V3 not displaying cahracters  (Read 1206 times)

T3Mentor

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
    • View Profile
NHD-0420D3Z-FL-GBW-V3 not displaying cahracters
« on: February 03, 2017, 08:24:14 AM »
I am using a NHD-0420D3Z-FL-GBW-V3 in the SPI mode to interface to an Arduino Uno.  Every time I write to the display, all the pixels in a character are illuminated,  as if is sent FF, rather than the actual 31 (1) that I was using to test my set up.  I have the baud rate set at 9600 (yes, slow I know, but I'm just testing at this point ) , MSBFIRST, and SPIMODE3.   I'm not sure what's going on here, any advice?   

Saurabh_B

  • Administrator
  • Hero Member
  • *****
  • Posts: 363
  • Karma: 10
    • View Profile
Re: NHD-0420D3Z-FL-GBW-V3 not displaying cahracters
« Reply #1 on: February 13, 2017, 10:57:13 AM »
Hello,

I have attached my SPI Code for this display using an Arduino:
Code: [Select]
//---------------------------------------------------------
/*
SPI Code.c
Program for writing to Newhaven Display Serial LCD Character Displays via SPI.

(c)2016 Saurabh Baxi - 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.
*/
//---------------------------------------------------------


// DEFINITIONS
#define SCLK  8
#define  SPIS  9
#define SDO   10

const char slave = 0x7E;
const char comsend = 0x00;
const char datasend = 0x40;

char const t1[]=(" Newhaven  Display  ");
char const t2[]=("=SERIAL==Peripheral=");
char const t3[]=("=====Interface======");
char const t4[]=("=ARDUINO=====TESTER=");
//Basic Functions/////////////////////////////
void spiout(unsigned char a){
  int n;
  unsigned char d;
  d = a;
  digitalWrite(SPIS,LOW);
  for(n =0; n<8; n++){
    delayMicroseconds(20);
    if((d&0x80)==0x80)
      digitalWrite(SDO, HIGH);
    else
      digitalWrite(SDO, LOW);
    d = (d<<1);
    digitalWrite(SCLK, LOW);
    delayMicroseconds(20);
    digitalWrite(SCLK, HIGH);
  }
  digitalWrite(SPIS, HIGH);
}
void disp(const char *text){
  int n;
  for (n = 0; n <20 ; n++){
    spiout(*text);
    text++;
    delay(10);
  }
}

void setup() {
  pinMode(SPIS, OUTPUT);
  pinMode(SDO, OUTPUT);
  pinMode(SCLK, OUTPUT);
  digitalWrite(SCLK, LOW);
  digitalWrite(SDO, LOW);
  digitalWrite(SPIS, HIGH);
  delay(10);
  spiout(0xFE);
  spiout(0x51); //Clear Screen
  delay(10);
  spiout(0xFE);
  spiout(0x46); //Cursor Home
  delay(5);
  spiout(0xFE);
  spiout(0x47); // Underline cursor
  delay(5);
  spiout(0xFE);
  spiout(0x53); // Set backlight Brightness
  spiout(8); // Value
  delay(2);
  spiout(0xFE);
  spiout(0x52); // Set Contrast
  spiout(40); // Value
}

void loop() {
  int i;
  spiout(0xFE);
  spiout(0x46); // Cursor Home
  delay(10);
  disp(t1); // Display T1
  delay(5);
  spiout(0xFE);
  spiout(0x45); // Set Curser Address
  spiout(0x40); // Line 2
  delay(5);
  disp(t2);
  spiout(0xFE);
  spiout(0x45);
  spiout(0x14); // Line 3
  delay(5);
  disp(t3);
  spiout(0xFE);
  spiout(0x45);
  spiout(0x54); // Line 4
  delay(5);
  disp(t4);
  spiout(0xFE);
  spiout(0x49); // Move cursor left 1 place
 while(1); // Wait here
}

Would you be able to send a picture of what you are seeing?

 

RS232 PIC CCS COMPILER COMANDS FOR NHD-0420D3Z-NSW-BBW-V3 ISSUE

Started by DavidVMBoard Character LCDs

Replies: 2
Views: 733
Last post May 30, 2017, 12:58:32 PM
by DavidVM
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
NHD-0420D3Z-NSW-BBW-V3 back-light flickers

Started by rickford66Board Character LCDs

Replies: 3
Views: 3539
Last post May 06, 2015, 08:34:09 AM
by fraryb
Changing the Slave Address with NHD-0420D3Z

Started by alkBoard Character LCDs

Replies: 2
Views: 2632
Last post January 13, 2015, 01:53:20 PM
by alk
Trouble with serial interface on NHD-0420D3Z-FL-GBW-V3

Started by chughesBoard Character LCDs

Replies: 4
Views: 3020
Last post September 29, 2015, 11:16:48 AM
by Paul_B