Author Topic: Having trouble with the NHD-0420DZW-AB5  (Read 2986 times)

daryllwin

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
    • View Profile
Having trouble with the NHD-0420DZW-AB5
« on: October 01, 2014, 10:41:54 PM »
Hi All

I'm having quite a bit of trouble with the display mentioned in the title and getting it to work with an Arduino UNO.

I've connected the display in serial mode, and my code is as shown below. I've also redid the jumpers behind as described in the datasheet.

Code: [Select]
/*
 Circuit:
 CS: pin 10
 MOSI: pin 11
 MISO: pin 12
 SCK: pin 13
 */

// the sensor communicates using SPI, so include the library:
#include <SPI.h>

const byte COMMAND = 0b11111100;     // read command
const byte DATA = 0b00000010;   // write command
const byte ON = 0b0000001111;  //turn display on

const int chipSelectPin = 10;

void setup() {
  Serial.begin(9600);
  SPI.begin();
  pinMode(chipSelectPin, OUTPUT);
  delay(100);
  digitalWrite(chipSelectPin, LOW);
  delay(100);
  SPI.transfer(0b0000111000);
  delay(100);
  SPI.transfer(0b0000001000);
  delay(100);
  SPI.transfer(0b0000000001);
  delay(100);
  SPI.transfer(0b0000000110);
  delay(100);
  SPI.transfer(0b0000000010);
  delay(100);
  SPI.transfer(0b0000001111);
  digitalWrite(chipSelectPin, HIGH);
  delay(100);
}

void loop() {
  digitalWrite(chipSelectPin, LOW);
  delay(100);
  SPI.transfer(0b1000011111);
  delay(1000);
  digitalWrite(chipSelectPin, HIGH);
}

Most of the time, the display shows gibberish. There are occasions (1 out of 5 roughly) where the display initializes properly, and a blinking cursor is shown at the first character.

However, even when it initializes correctly, the cursor never moves, which I'm guessing means that the display isn't receiving any data from the Arduino.

This kind of baffles me because it must have received the initialization commands for it to show the blinking cursor right?

daryllwin

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
    • View Profile
Re: Having trouble with the NHD-0420DZW-AB5
« Reply #1 on: October 02, 2014, 04:53:35 AM »
Just an update.

I added a line of code setting the CS pin to HIGH at the beginning, and this has gotten rid of most of the gibberish.

I still cannot, however, write anything to the screen after the initialization procedure.

Can anyone help with this please. Thanks.

Michael_L

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 33
    • View Profile
Re: Having trouble with the NHD-0420DZW-AB5
« Reply #2 on: October 02, 2014, 09:52:09 AM »
I have also responded to your post in the other thread about this, and I think a cause of your problem could be due to the fact that the Arduino SPI library needs 8-bit values to work properly.

daryllwin

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
    • View Profile
Re: Having trouble with the NHD-0420DZW-AB5
« Reply #3 on: October 02, 2014, 10:13:37 AM »
Thanks for the quick reply.

I'll try using it with the Liquid Crystal library when I get the chance.

 

Questions regarding NHD‐0220DZW‐AY5 & NHD‐0420DZW‐AY5

Started by tseyfarthBoard OLEDs

Replies: 3
Views: 2871
Last post August 20, 2015, 09:51:26 AM
by Saurabh_B
NHD‐0420DZW‐AB5 Lines

Started by RickJBoard OLEDs

Replies: 1
Views: 2278
Last post January 09, 2015, 04:18:32 PM
by Michael_L
NHD‐0420DZW‐AY5 SPI Interface

Started by vinaykBoard OLEDs

Replies: 0
Views: 2048
Last post October 26, 2015, 05:13:10 AM
by vinayk
NHD-0420DZW-AG5 - Display "sometimes" shows only 2 lines

Started by stylonurusBoard OLEDs

Replies: 5
Views: 5574
Last post June 18, 2014, 10:09:49 AM
by Michael_L
NHD‐0420DZW‐AY5 - Power consumption and luminance difference 3.3V/5.0V?

Started by MonkeywrenchBoard OLEDs

Replies: 0
Views: 1458
Last post November 20, 2015, 06:40:16 PM
by Monkeywrench