Graphical LCD interfacing with AT89c51

Thread Starter

@vajra

Joined May 2, 2018
150
Hello All

I am trying to interface Graphical LCD JHD12864E with AT89C51. I have downloaded Datasheet of JHD12864E. I looked pin connection in Datasheet but I don't understand where to connect Pin 3, Pin17 and Pin 18

I have done following connection

Pin 1 ------ Ground
Pin 2 ------ 5V Supply
Pin 3 ------
Pin 4 ------ - Port P3.0 (RS)
Pin 5 ------ - Port P3.1(R/W)
Pin 6 ------ - Port P3.2(E)
Pin 7 ------ - Port P1.0
Pin 8 ------- Port P1.1
Pin 9 ------ - Port P1.2
Pin 10 ------ Port P1.3
Pin 11 ------ Port P1.4
Pin 12 ------ Port P1.5
Pin 13 ------ Port P1.6
Pin 14 ------ Port P1.7
Pin 15 ------ Port P3.3
Pin 16 ------ Port P3.4
Pin 17 ------
Pin 18 ------
Pin 19 ------ 5v LED +
Pin 20 ------ Ground LED-

Please help me to interface Graphical LCD with AT89c51
 

Attachments

Last edited:

Thread Starter

@vajra

Joined May 2, 2018
150
You've created the HW interface. Now create the SW interface.
I have not connected all Pins. If I don't connect, Will it work?

I am not sure weather LCD is working or not, because I got it from someone. It's not useful to him
 

jpanhalt

Joined Jan 18, 2008
8,711
Pin3 is Vo which controls contrast. Some devices just use a pot between VCC (V+) and ground. Other displays need it to be between VCC and a negative potential. As Mr Chips said, Pin18 is -10V. That can be conveniently generated by the MCU like this:
upload_2018-6-5_12-49-1.png

N$9 is the input which is a PWM signal. N$20 is a variable output to Vo in my circuit. That particular graphical display needed a negative Vo. Pin 18 may not need to be connected. If you connect the negative voltage directly to Pin18, you might get away with just a pot on Pin3. There are small differences between graphical displays. The one referenced here is a New Haven Display. Its datasheets might help you more.

You can also get dedicated chips to generate a -10V.
 

Thread Starter

@vajra

Joined May 2, 2018
150
Pin-17 is /RESET - connect to +5V
Pin-18 is -10V

You would not know if the LCD is working until you get it working.:rolleyes:
That's why I want to sure weather my hardware connection is right or wrong. Once it sure that there is no problem in hardware connection. I will check LCD with program.

My Problem is
  1. if I don't connect Pin 3 and Pin 18. Will it work ?
  2. I don't have negative -10 v supply. Where to connect Pin 18 ?
  3. I have 5v and 12 v dc. Where to connect Pin 3 ?
 

MrChips

Joined Oct 2, 2009
20,167
Pin-3 is contrast adjustment. You might be fooled into thinking the LCD is not working when in fact it is really working and the contrast setting is not right.
Connect pin-3 to the wiper of a 10k pot. The pot is connected between VDD and VSS.
Connect pin-18 to -10V.
 

jpanhalt

Joined Jan 18, 2008
8,711
Here's a link to an NHD graphical display: http://www.newhavendisplay.com/specs/NHD-12864WG-BTMI-VN.pdf
Go to DigiKey and search though datasheets for NHD and you may find an exact fit. Here's a schematic from the above link:

upload_2018-6-5_13-24-31.png

EDIT:060618
The above schematic was grabbed without much regard to the full part number. My intent was to show the need for using Vee in the contrast control for some displays. In fact, the NHD12864WG provides that negative supply. The NHD12864MZ ( http://www.newhavendisplay.com/specs/NHD-12864MZ-FSW-GBW-L.pdf ) does not and my experience was with the latter device. It required an externally generated negative voltage. The datasheet provided for the JHD12864E is silent or at best ambiguous on whether the Vee pin provides the negative voltage or requires it. It refers to "Note 4," which does not exist in the versions I downloaded. Initially, I was concerned that by posting the "WG" version, I had unintentionally caused confusion. As it turns out, this link: https://exploreembedded.com/wiki/File:GLCD_Atmega32.png shows a working version of the JHD12864E with that pin used as a source for Vee.
 
Last edited:

jpanhalt

Joined Jan 18, 2008
8,711
Pin-3 is contrast adjustment. You might be fooled into thinking the LCD is not working when in fact it is really working and the contrast setting is not right.
Connect pin-3 to the wiper of a 10k pot. The pot is connected between VDD and VSS.
Connect pin-18 to -10V.
I agree that may work,but with the NHD and presumably others, there needs to be a negative bias to see the characters. Posted the schematic above.
 

Thread Starter

@vajra

Joined May 2, 2018
150
jpanhalt && Mrchips

My problem is I don't have -10 v supply. Is it necessary to connect it with -10 v supply

if I don't connect it with -10 v supply What will happen, Will it not display message on screen?
 

jpanhalt

Joined Jan 18, 2008
8,711
First, you can generate a -V (maybe not -10, but close) using a pin from your MCU. You can also buy a voltage converter. The ICL7660 (or other devices ending in 7660) is popular and gives -10 V from a 5V supply. Finally, you can take a 9V battery, connect its + lead to ground and its negative to Vo, etc. I strongly suspect you do not need -10V per se. You can probably get by with -5V, but as I have said earlier, some of those displays must have a negative bias voltage. The current draw is very low and a battery will last a long time.

Your datasheet doesn't have very much information in it. Have you looked at the NHD datasheert(s)? Finally, if you read more detail about the NHD displays there are cautions about connecting the negative voltage before the positive voltage. I mention that in case you use a battery, you may need to disconnect the voltages in a certain sequence.
 

Thread Starter

@vajra

Joined May 2, 2018
150
I have 9v step down transformer. It give 9v Ac output. Is it possible to use negative output of supply for Graphical LCD.?
 

shteii01

Joined Feb 19, 2010
4,647
did you notice by now that it would be muuuuuuuuuuuuuuuuuuuuuuuuuuch easier to just get an lcd display that actually matches your mcu?

this is one of those life examples where "free stuff" is not actually free because you are wasting hours and days of your life to figure out how to get the "free stuff" to work, and then you need to buy parts to get the "free stuff" to work for what you need. same money can be spent on lcd that actually fits your mcu and you just copy the code to get it to work from people who have figured it out 20 or 30 years ago.
 

Ian Rogers

Joined Dec 12, 2012
698
If you read the data sheet... The Vee is supplied from the display... Pin 18 is the negative supply for the contrast... A 10k pot between Vee and Vcc will work fine.... The whole thing runs from 5v..

Pin 3 is the pot output.. Pin 17 is reset ( I make this permanently high, but you can control it )..
 

Thread Starter

@vajra

Joined May 2, 2018
150
Last edited:

Thread Starter

@vajra

Joined May 2, 2018
150
I have tested code in given link but I don't see any text on LCD screen.
C:
#include<reg51.h>

/* Configure the data bus and Control bus as per the hardware connection
   Dtatus bus is connected to P20:P27 and control bus P00:P04*/
#define GlcdDataBus  P2
sbit RS  = P0^0;
sbit RW  = P0^1;
sbit EN  = P0^2;
sbit CS1 = P0^3;
sbit CS2 = P0^4;

/* 5x7 Font including 1 space to display HELLO WORLD */
char H[]={0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00};
char E[]={0x7F, 0x49, 0x49, 0x49, 0x41, 0x00};
char L[]={0x7F, 0x40, 0x40, 0x40, 0x40, 0x00};
char O[]={0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00};

char W[]={0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00};
char R[]={0x7F, 0x09, 0x19, 0x29, 0x46, 0x00};
char D[]={0x7F, 0x41, 0x41, 0x22, 0x1C, 0x00};


/* local function to generate delay */
void delay(int cnt)
{
   int i;
    for(i=0;i<cnt;i++);
}


void Glcd_SelectPage0() // CS1=1, CS2=0
{
    CS1 = 1;
    CS2 = 0;
}

void Glcd_SelectPage1() // CS1=0, CS1=1
{
    CS1 = 0;
    CS2 = 1;
}

/* Function to send the command to LCD */
void Glcd_CmdWrite(char cmd)
{
    GlcdDataBus = cmd;   //Send the Command
    RS = 0;              // Send LOW pulse on RS pin for selecting Command register
    RW = 0;              // Send LOW pulse on RW pin for Write operation
    EN = 1;              // Generate a High-to-low pulse on EN pin
    delay(100);
    EN = 0;

    delay(1000);
}

/* Function to send the data to LCD */
void Glcd_DataWrite(char dat)
{
    GlcdDataBus = dat;   //Send the data on DataBus
    RS = 1;              // Send HIGH pulse on RS pin for selecting data register
    RW = 0;              // Send LOW pulse on RW pin for Write operation
    EN = 1;              // Generate a High-to-low pulse on EN pin
    delay(100);
    EN = 0;

    delay(1000);
}

void Glcd_DisplayChar(char *ptr_array)
{
    int i;
    for(i=0;i<6;i++) // 5x7 font, 5 chars + 1 blankspace
        Glcd_DataWrite(ptr_array[i]);
}


int main()
{
    /* Select the Page0/Page1 and Turn on the GLCD */
    Glcd_SelectPage0();
    Glcd_CmdWrite(0x3f);
    Glcd_SelectPage1();
    Glcd_CmdWrite(0x3f);
    delay(100);

    /* Select the Page0/Page1 and Enable the GLCD */
    Glcd_SelectPage0();
    Glcd_CmdWrite(0xc0);
    Glcd_SelectPage1();
    Glcd_CmdWrite(0xc0);
    delay(100);

    Glcd_SelectPage0(); // Display HELLO on Page0, Line1
    Glcd_CmdWrite(0xb8);
    Glcd_DisplayChar(H);
    Glcd_DisplayChar(E);
    Glcd_DisplayChar(L);
    Glcd_DisplayChar(L);
    Glcd_DisplayChar(O);

    Glcd_SelectPage1(); // Display WORLD on Page1, Last line
    Glcd_CmdWrite(0xbF);
    Glcd_DisplayChar(W);
    Glcd_DisplayChar(O);
    Glcd_DisplayChar(R);
    Glcd_DisplayChar(L);
    Glcd_DisplayChar(D);

    while(1);
}
screen shot of LCD
GLCD.jpg
 
Top