Newhaven NHD-C0220AZ-FSW-FTW

I am trying to use the newhaven NHD-C0220AZ-FSW-FTW LCD display with an Arduiino Pro-Mini. Does anyone have any idea why this display just won't work? I cannot get a thing out of it; not even an indication that it sees power even though there is 3.3V to it.

I am using the pro Mini 3.3, ATmega328 and am only trying to initialize it. I am not a programmer by any means so please if you see something wrong, please respond. Also, this is just the preliminary stage. I have to get something out of it before I can continue. I am using port registers for my data lines. (PORTB) I do have all the correct responses on my logic analyzer, just cannot get anything out of this LCD dsplay. I don't even know if I can use an Arduino with it.

I followed the timing diagram in the Newhaven data sheet to set enable, RW, and RS on and off and to collect data, then followed the 4-bit interface sequence in the NT7605 datasheet to initialize. In the end after each line I should have initialized and then wrote an N.

Here is my code:

//Enable
//R/W
//R/S

//D7
//D6
//D5
//D4

//PORTB =

//Global Variables

int E = 7; // Enable pin on LCD set to digital pin 7 on Arduino
int RW = 6; // R/W pin on LCD set to digital pin 6 on Arduino
int RS = 5; // R/S pin on LCD set to digital pin 5 on Arduino

void setdata(int data, int mode) // Bus Write Operation Sequance Function
{
pinMode(E, OUTPUT);
pinMode(RW, OUTPUT);
pinMode(RS, OUTPUT);

digitalWrite(RW, LOW);
delay(10);
digitalWrite(E, HIGH);
delay(10);

if(mode) //mode set to zero to write commands
digitalWrite(RS, LOW);

else
digitalWrite(RS, HIGH);

delay(10);

PORTB = data;

delay(10);

digitalWrite(E, LOW);
delay(10);
digitalWrite(RW, LOW);
delay(10);
digitalWrite(E, HIGH);
delay(10);
}

void setup ()

{

//Pins 13 to 8. NOTE: bits (7,6) are not usable
//DDRB = B11111111; // Sets the 13-8 pins as outputs

DDRB = DDRB | B11111111; // NOTE - the bitmask '| B11111100'
// sets the 13-8 pins as outputs

PORTB = B00000000; // NOTE - this sets everything to '0'

pinMode(RS, OUTPUT);

digitalWrite(E, LOW); //Start up
digitalWrite(RW, LOW);
digitalWrite(RS, LOW);

delay(10);

setdata(0x02, 1); //Start Function set
//delay(10);

setdata(0x02, 1);
//delay(10);

setdata(0x08, 1);
delay(10); //wait more than 40us

setdata(0x00, 1); // Start Display ON/OFF controls
//delay(10);

setdata(0x07, 1);
delay(10); //wait more than 40us

setdata(0x00, 1); //Start Clear Display
//delay(10);

setdata(0x01, 1);
delay(10); //wait more than 1.64ms

setdata(0x00, 1); //Start Entry Mode Set
//delay(10);

setdata(0x02, 1); //Initialization End
//delay(10);

setdata(0x04, 0); // Start Write to DDRAM
//delay(10);

setdata(0x0E, 0); //Write 'N'
//delay(10);

digitalWrite(E, LOW);
delay(10);

}

void loop ()

{
}

MANY THANKS IN ADVANCE TO ANYONE THAT HAS ANY COMMENTS!!!!

You really should post a link to the datasheet for your display. Most LCDs are compatible with the Hitachi HD44780 controller but some of the New Haven displays differ, so it is important to have the correct datasheet.

Your code would be easier to read if you took advantage of the formatting abilities of the forum software. Highlight the section of your post that represents code and then press the 'Code' button which looks like '#'.

I cannot get a thing out of it; not even an indication that it sees power even though there is 3.3V to it.

I can't speak for the New Haven Displays but most of the others will show a single row of blocks if you connect pins 1, 2, and 3 and adjust the contrast.

Your initialization sequence does not look familiar.

Your use of the Enable pin does not look familiar either. Normally 'E' is kept low since it must be low while you set up RS and R/W and kept low for a short time after those two lines are set up. Most programmers also set up the data lines while E is low but you can drive it high first and then set up the data (this is how the timing diagrams show things). E must be high for a designated amount of time and then you drive E low at which time the actual data transfer takes place. You must keep the data stable for some time after E goes low. So if you were to look at the E line with an oscilloscope it would be low almost all of the time and it is pulsed high, then low again to transfer data.

Don

Thank you for the response!

Here is the link to the Display datasheet

I followed the timing diagram on page 8 of this datasheet.

In my code I wrote a function (setdata) :

[void setdata(int data, int mode) // Bus Write Operation Sequence Function
 {
   pinMode(E, OUTPUT);
   pinMode(RW, OUTPUT);
   pinMode(RS, OUTPUT);
   
   
   
   digitalWrite(RW, LOW);
   delay(10);
   digitalWrite(E, HIGH);
   delay(10);
   
     if(mode)    //mode set to zero to write commands
     digitalWrite(RS, LOW);
     
      else
       digitalWrite(RS, HIGH);
   
   
   delay(10);
   
   PORTB = data;
 
   delay(10);
   
   digitalWrite(E, LOW);
   delay(10);
   digitalWrite(RW, LOW);
   delay(10);
   digitalWrite(E, HIGH);
   delay(10);
 }]

[code]

I set E, RW low and RS stays low to write commands (setting mode to 1 means RS low, if mode sees a 0 then RS sees a 1 and thats when we write to DDRAM), then E goes high, data gets pushed through and then E goes low and high...this is how I read it. I hope that is correct.

this timing sequence has to happen before each 'data' can pass through. On page 25/31 of the NT7605 controller datasheet I use the 4-bit interface initialization sequence where each line must first read the timing sequence and then the data can pass.

Here is the link to the NT7605 controller
http://www.allshore.com/pdf/Novatek%20NT7605.pdf

So in my code I call the function, and then send the data.

the first line of 'Function set' on page 25 is 000010XXXX so I call setdata and send it 000010 (which is 2 binary or 0x02 hex), then the next line and the next line then a delay. I believe that function set for the LCD should be set.....Again this is how I read it, I hope this is correct.

I spoke to Newhaven and they suggest using their development kit but assure me that this display works with other processors. They do not know if it works with an Arduino nor do they have any code suggestions. I am merely wondering if anyone out there has ever used this display with an arduino and if so can they help with initialization code.

Thank you again for responding, it is greatly appreciated!

[/code]

Did you notice in the datasheet that the display has a minimal operating of 3.3V? Your 3.3V arduino is on the low end of this operating parameter. It may simply not work. On page 4 of the doc, it tells you how to connect the wires. You should show us how you are connecting it with pictures. Notice pin 2 is contract and 3 is VDD, just opposite to most HD44780-compatible displays I've seen.

Thanks for your response!!

I have it wired correctly. VDD is on 3 and the sweeper is on pin 2, pin 1 is gnd. I will try to post pics. I have also asked Newhaven about the voltage and they said yes, it should still work but still I put 5V on VDD instead of 3.3 to no avail. I have hooked up a logic analyzer to view that I am getting the right results and yes indeed the outcome is as i set it up....still nothing on this display. I have even tried two other displays (maybe that one was bad?) nothing. I am out of a solution here. Thats why I posted to the world if anyone else has ever tried using this display with an arduino, please help.

Thank you very much for responding, I really appreciate it!!!

raviolidon:
Thanks for your response!!

I have it wired correctly. VDD is on 3 and the sweeper is on pin 2, pin 1 is gnd. I will try to post pics. I have also asked Newhaven about the voltage and they said yes, it should still work but still I put 5V on VDD instead of 3.3 to no avail. I have hooked up a logic analyzer to view that I am getting the right results and yes indeed the outcome is as i set it up....still nothing on this display. I have even tried two other displays (maybe that one was bad?) nothing. I am out of a solution here. Thats why I posted to the world if anyone else has ever tried using this display with an arduino, please help.

Thank you very much for responding, I really appreciate it!!!

I'd like to trust your hardware capabilities but that trust is often earned here by demonstrating the connections :wink:
Between 3 displays, the only thing that didn't change was who hooked them up. It was you :slight_smile: Waiting for those pictures.

I hope these go through :slight_smile:

I suppose I should also note that I am using the first four data lines on the LCD (DB7-DB4, pins 14-11) and the other data lines I have grounded. So you may see they are jumpered together to a resistor to ground. I am sorry if it is hard to see :~

All three links prompted me to log in. Can you simply attach to the post? Click Additional options on bottom left of the post reply box and you can attach a few photos.

raviolidon:
I suppose I should also note that I am using the first four data lines on the LCD (DB7-DB4, pins 14-11) and the other data lines I have grounded. So you may see they are jumpered together to a resistor to ground. I am sorry if it is hard to see :~

I don't think you are supposed to ground the unused data lines.

Ok, here are the attached photos.

I had gotten a recommendation to ground the other lines. It didn't change anything either way.

Thank you!!

Another photo

Logic Analyzer output 0 = E, 1= RW, 2 = RS....The data lines are 7 (to DB7), 6 (to DB6), 5 (to DB5), 4 (to DB4).

I recommend going back to square 1. Remove connections to arduino, remove that 10K resistor (what's it for?), power the lcd with 5V from that UNO, adjust contrast until you can see blocks. If that all works, power the lcd with 3.3V and readjust contrast until you can see blocks.

If the above works, use the UNO and proper contrast for 5V supply and run an lcd sample code.

Ugh. :~ Well, I have just finished doing most of that. I am not using the UNO, I can't. I am using the Pro-Mini but nonetheless, I have done that. I even took a separate 5V supply and attached it to the LCD (pins 3, 2, 1) with the pot on a separate breadboard and played with voltage down to zero and gotten nothing. I am at wits end. I will keep trying. If I come to any conclusions I will post again. Thank you very much for your help....If anyone out there knows anyone out there that has used this Display with an Arduino, Please please post. Cheers

Also, If you have any sample code, could you please post? I really appreciate it. Thank you!

raviolidon:
Also, If you have any sample code, could you please post? I really appreciate it. Thank you!

There are several in arduino IDE.

What about soldering? Did you do a good job with soldering?

raviolidon:
Also, If you have any sample code, could you please post? I really appreciate it. Thank you!

In the IDE, File > Examples > LiquidCrystal

I use a lot of the New Haven Display products and the standard LiquidCrystal library works with most of them. I haven't used the specific one you are trying to apply, however.

I guess it's admirable to try to write your own driver but if it was me I would try the standard library first. If you do decide to try to fix yours, I will suggest that those 10 mS delays you've got everywhere are waayyyy to long, I think you would be better off using delayMicroseconds() and use the values from your data sheet.

OK, I will change it. I had delays like that so I could initially see what was happening. I will take a look at the examples but I am sure that I searched extensively for something on this particular LCD and found nothing. Thank you again, keep posting please if you hear anything. Cheers

there is 3.3V

Most of those devices require around 4v on the contrast pin vs. the positive rail - thus they are rated for 5v applications.

In a 3.3v environment, you will need to create a negative voltage (-1v or more) and apply it to the contrast pin (Vdd in your case).

There are many ways to create that. A simple one would be to send a pulse train to a charge pump (two diodes + two caps). For example, you can use the analog write function to do that.

The display looks to be hd44780 compliant so the regular code should work.