Author Topic: Nothing Display on my NHD-0108CZ-FSW-GBW-33V3  (Read 2291 times)

YSUN

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
    • View Profile
Nothing Display on my NHD-0108CZ-FSW-GBW-33V3
« on: November 21, 2014, 02:24:38 PM »
Hi, All

I have been working on this LCD several days, but get no display on the screen. Firstly, I am pretty sure that all the connections are correct. Here I writing for asking help about the code .

I use the Atmel studio 6.2 , the board is atmega328p mini . PortB0 --PortB7 are for the bus line (8-bit ), PortD pin 0 , 1 , 2 are the control pins.

My code is written  based on the example program code given on Newhaven website (   you can find the demo code here : http://www.newhavendisplay.com/app_notes/8_bit_character_C.txt )

And here below is my code :

#include <avr/io.h>
#include <util/delay.h>

#define E PORTB0 // en
#define Rw PORTB1 // R/W
#define Rs PORTB2 // RS

volatile xdata_at_0xB0_char_E;
volatile xdata_at_0xB1_char_Rw;
volatile xdata_at_oxB2_char_Rs;

char const text[] = {"eniware-"};

//void commamd ( char i );
//void write ( char i );
//void init();
//void disp_pic();
//void main(void);

void command (char i)
{
   PORTD = i;
   PORTB &= ~ (1<<Rs);// rs = 0
   PORTB &= ~(1<<Rw);// rw =0
   PORTB |= 1<<E;// en = 1
   _delay_ms(10);
   PORTB &= ~(1<<E); // en = 0
}

void write (char i)
{
   PORTD = i;
   PORTB |= (1<<Rs); // rs 1
   PORTB &= ~ (1<<Rw); // rw 0
   PORTB |= 1<<E; // en 1
   _delay_ms(10);
   PORTB &= ~ (1<<E); // en 0
}

void init()
{
   PORTB &= ~ (1<<E); // en 0
   _delay_ms(10);
   
   command(0x30); //#1
   _delay_ms(100);
   command(0x30); //#2
   _delay_ms(10);
   command(0x30); //#3
   _delay_ms(10);
   
   command(0x38);
   command(0x10);
   command(0x0c);
   command(0x06);

}

void disp_pic()
{
   int i;
   command(0x01);
   _delay_ms(10);
   
   for (i=0;i<8;i++)
   {
      write(text);
   }
   
}

void main (void)
{
   PORTD = 0;
   PORTB = 0;
   while(1)
   {
      init();
      disp_pic();
      _delay_ms(1000);
   }
}

Is there anyone can tell me what is wrong with my code ?  Many thanks in advance.
« Last Edit: November 24, 2014, 09:24:18 AM by YSUN »

Michael_L

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 33
    • View Profile
Re: Nothing Display on my NHD-0108CZ-FSW-GBW-33V3
« Reply #1 on: November 24, 2014, 08:52:12 AM »
Our example code is verified to work correctly.  Have you verified your signals are working/toggling correctly with a scope?
Also, typically you need to set up the ports as outputs in your code.
For example :
DDRB = 0xFF;
DDRD = 0xFF;

 

Blank Display on NHD‐C0220BiZ‐FS(RGB)‐FBW‐3VM

Started by SteveCBoard Character LCDs

Replies: 3
Views: 4575
Last post May 13, 2014, 12:04:36 AM
by SteveC
NHD‐C12864A1Z‐FSW‐FBW‐HTT display clears after draw

Started by EdAverillBoard Graphic LCDs

Replies: 6
Views: 5709
Last post November 07, 2014, 08:25:20 AM
by Michael_L
NHD‐4.3‐480272EF‐ATXL#‐CTP | FAN5333 | BBB | Nothing on the Display

Started by Alias_AliasBoard TFTs

Replies: 1
Views: 3420
Last post September 25, 2015, 03:09:24 PM
by Paul_B
Arduino LCD library not working with newhaven display NHD‐0420H1Z‐FL‐GWB-3V3

Started by c2hollowBoard Character LCDs

Replies: 9
Views: 8840
Last post July 10, 2014, 08:46:06 AM
by Michael_L
NHD-0420DZW-AG5 - Display "sometimes" shows only 2 lines

Started by stylonurusBoard OLEDs

Replies: 5
Views: 5582
Last post June 18, 2014, 10:09:49 AM
by Michael_L