Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - c2hollow

Pages: [1]
1
hmm I modified the original code you sent me so that it operates in 4 bit mode:
Code: [Select]
// R/W signal is tied to ground (always write, never read)

int RS = 11;   //RS signal connected to digital pin 30 of Arduino Mega2560
int E = 12;    //E signal connected to digital pin 30 of Arduino Mega2560

const char text1[] = {"Newhaven Display"};
const char text2[] = {" Character LCD  "};

void command(char c)

   digitalWrite(RS, LOW);
   PORTD = c;
   digitalWrite(E, HIGH);
   delay(1);
   digitalWrite(E, LOW);
   c = c<<4;
   PORTD = c;
   digitalWrite(E, HIGH);
   delay(1);
   digitalWrite(E, LOW);
}

void command8(char c)

   digitalWrite(RS, LOW);
   PORTD = c;
   digitalWrite(E, HIGH);
   delay(1);
   digitalWrite(E, LOW);
}

void data(char d)
{
   digitalWrite(RS, HIGH);
   PORTD = d;
   digitalWrite(E, HIGH);
   delay(1);
   digitalWrite(E, LOW);
   d= d<<4;
   PORTD = d;
   digitalWrite(E, HIGH);
   delay(1);
   digitalWrite(E, LOW);
}

void Home()
{
   command(0x01);
   delay(5);
}

void nextline()
{
   command(0xC0);
}

void disp_pic()
{
   int i;
   Home();
   for (i=0;i<16;i++)
   {
      data(text1[i]);
   }
   nextline();
   for (i=0;i<16;i++)
   {
      data(text2[i]);
   }
}

void setup()
{
   DDRD = 0xFF;    //set PORTA as output
   PORTD = 0x00;   //initialize PORTA to 0x00
   pinMode(RS, OUTPUT);
   pinMode(E, OUTPUT);
   digitalWrite(E, HIGH);
   delay(40);
   command8(0x30);
   delay(5);
   command8(0x30);
   delay(5);
   command8(0x30);
   delay(5);
   command(0x28);
   command(0x10);
   command(0x0F);
   command(0x06);
   delay(5);
}

void loop()

  disp_pic();
  delay(5000);
}
and now it works perfectly fine...

2
To be specific, it only prints characters from the upper 4 bit 0110 and 0111 rows, and the lower 4 bit rows where bit 4 and bit 5 are 1.

How bizarre.

3
I got the arduino HelloWorld example working (but only with 4 pins, not 8-pin operation). Turns out I was getting pins 1-8 mixed up with pins 7-16.

However, the sample code you provided in the other forum thread only occasionally print the correct message, and then otherwise print gibberish. The arduino helloWorld code prints gibberish in 8-bit mode.

4
Character LCDs / Re: Problems with a NHD‐0420H1Z‐FL‐GBW‐3V3
« on: July 09, 2014, 11:04:40 AM »
Do you know why the first and third lines would be full of boxes and the other lines are blank? Could that provide me a clue as to what I'm doing wrong in the initialization?

5
What happens if you run the module at 5V for too long? is there an easy way to test whether the module has gone bad?

6
Should the logic voltage supply be going into the 5V line or the 3.3V line?

7
Assuming that my code for controlling the NHD‐0420H1Z‐FL‐GWB-3V3 is the reason that it isn't working, I plugged it into a breadboard and attempted to get the Arduino LCD example working:

http://arduino.cc/en/Tutorial/LiquidCrystal

However, nothing is happening. Is there anything nonstandard about the LCD controller chip in this module?

8
Character LCDs / Re: Problems with a NHD‐0420H1Z‐FL‐GBW‐3V3
« on: July 08, 2014, 01:17:09 PM »
I don't understand, if 0x30 is the function set, then why further down in the code is there:

command(0x38); //Function set: 8-bit/2-line

9
Character LCDs / Problems with a NHD‐0420H1Z‐FL‐GBW‐3V3
« on: July 07, 2014, 11:52:27 AM »
I have an NHD‐0420H1Z‐FL‐GBW‐3V3 that I am having trouble getting working.

I have re-created the sample code for the "Example Initialization Program", and confirmed that I am sending 3.3 volt signals along all the appropriate pins. However, I seem to be unable to send any characters to the display - All I see are blocked out first and third lines.

I'm not sure where to go from here in terms of debugging. The only thing I've noticed is that in the sample code there is: "command 0x30 = Wake up". I can't find this command in the manual for the LCD driver, so I don't know exactly what it does.

Pages: [1]