+ All Categories
Home > Documents > LCD Tutorial

LCD Tutorial

Date post: 29-Oct-2015
Category:
Upload: sahil-khan
View: 161 times
Download: 2 times
Share this document with a friend
Description:
LCD Tutorial 8051
44
7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog iamsuhasm.wordpress.com/tutsproj/using-lcds/ 1/44 Suhas's Blog वि◌यादान सव दानधानम [Tut] – Using HD44780 based LCDs – JHD162A I finally dug out that LCD from the mess in my room and got it to work . Turns out , its really simple. You dont even need a microcontroller to do it. Ok. Lets get started : Front View of the LCD That is the LCD that i bought from SP road (kwality electronics) for 100 bucks. It incorporates the
Transcript
Page 1: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 1/44

Suhas's Blog

वि◌�यादान ंसव�दान�धानम्

[Tut] – Using HD44780 based LCDs – JHD162A

I finally dug out that LCD from the mess in my room and got it to work . Turns out , its really

simple. You dont even need a microcontroller to do it.

Ok. Lets get started :

Front View of the LCD

That is the LCD that i bought from SP road (kwality electronics) for 100 bucks. It incorporates the

Page 2: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 2/44

That is the LCD that i bought from SP road (kwality electronics) for 100 bucks. It incorporates thewidely popular HD44780 pin configuration. It has 16 pins.

This is how it looks from the back :

Back view of the LCD

There are 16 pins in all. They are numbered from left to right 1 to 16 (if you are reading from thebackside) . My LCD came with a marking to indicate which was the 1st pin and which was the 16th.You can see the markings right next to 1st and 16th pins.

I took the back view pic after I soldered a 8 pin connector between the 7 to 14 pins to make it easier towork with. When you buy the LCD ,all the pins will be bare. ( like in the first pic).

Did you notice that there is a fine film covering the LCD display in the first pic? DON’T remove it untilyou finish soldering wires and connectors to the pins. Otherwise ,the flux and the alcohol that you useduring the soldering process will ruin the LCD.

What do the 16 pins do?

Page 3: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 3/44

Page 4: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 4/44

Solder a 8 Pin connector to the Data pins and wires to the others

Pin 1 and 2 are the power supply pins. They need to be connected to the negative rail and the postive

rail of a +5v power supply respectively. To get a stable +5v Power supply , you can use a 7805 voltageregulator. It will regulate any voltage that you give it into +5v. If you are confused about using the

7805 , check out this tutorial.

Pin 3 is the contrast setting pin. It is said that it must be connected to a potentiometer to control thecontrast. However , i have found that it work if you just connect a variable resistor in series with it to

GND. The lower the resistance , the greater the contrast. I recommend setting it at around 1.5K – 2K. If

you set the value too low or short the pin directly to ground , you will see only dark boxes on thescreen. As far as i know , doing this does not have any adverse affect on the LCD.

If putting the Var-resistor does not work out for you , try the old fashioned method with a 10K pot. You

must set the voltage to around 1-1.5V for optimum contrast.

Pins 4 , 5 and 6 are control pins of the LCD. I’ll explain about them later on in the post.

Pins 7 to 14 are the Data pins of the LCD. Pin 7 is the Least Significant Bit (LSB) and pin 14 is theMost Significant Bit (MSB) of the data inputs. If you want to display some number or letter on the

display , you have to input the appropriate ‘codes’ for that character on these pins. These pins are also

used for giving certain commands to the display like clearing the display or moving the cursor to adifferent location. Upon giving the correct signals to the 3 control pins , the character codes or the

Page 5: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 5/44

commands that you have given to the Data pins will be written to the display or executed by the LCDrespectively. To make it easier to give the appropriate inputs to these pins , i recommend wiring up a

DIP switch to these pins.

Pins 15 and 16 : Most LCDs have a backlight. A backlight is a light within the LCD panel whichmakes seeing the chracters on screen easier. When you leave your cell phone or mp3 player untouched

for sometime , the screen goes ‘dark’. That is the backlight turning off. It is possible to use the LCDwithout the backlight as well. Many LCDs come without a backlight. If your LCD has only 14 pins ,

then it has no backlight. However , the working of the LCD still remains the same even if your LCD

doesnt have a backlight. The Backlight is nothing but an LED. So , a resistor must be connected inseries with it to limit the current. I am not sure about what value of resistor must be used. This link

mentions that the allowable current is 100ma. Then it is best to have a variable resistor (or a transistor)and adjust the current till it is around 90 ma.

Now for the important part : The 3 control pins : R/S , R/W

and E

The RS Pin

The LCD has basically two operating modes : Instruction mode and Character Mode

Page 6: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 6/44

Depending on the status of this pin , the data on the 8 data pins (D0-D7) is treated as either an

instruction or as character data.

You have to activate the command mode if you want to give a Instruction to the LCD. Example –“Clear the display” , “Move cursor to home” etc.

You have to activate the character mode if you want to tell the LCD to display some character.

To set the LCD in Instruction mode , you set the 4th pin of the LCD (R/S) to GND. To put it in character

mode , you connect it to Vcc.

The Enable Pin

The enable pin has a very simple function. It is just the clock input for the LCD. The instruction or thecharacter data at the data pins (D0-D7) is processed by the LCD on the falling edge of this pin. The

Enable pin should be normally held at Vcc by a pull up resistor. When a momentary button switch is

pressed , the Pin goes low and back to high again when you leave the switch. Your instruction orcharacter will be executed on the falling edge of the pulse. (ie. The moment the switch closes)

The RW Pin

Generally , we always use the LCD to show things on the screen. However , in some rare cases , we

may need to read from the LCD what it is displaying. In such cases, the R/W pin is used. However , thisfunction is beyond the scope of post and will not be explained. For all practical purposes , the R/W pin

has to be permanently connected to GND.

The flowchart for operating the LCD

Making the hardware required for driving the LCD

Page 7: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 7/44

Ok. Now that you have understood this , before starting , it would be more convenient if you solderedtogether a board with connectors and buttons for controlling all the pins.

Here’s the circuit :

Circuit for the LCD

You can solder together a board or you can mount the components on a breadboard. It is upto you todecide.

Note : In the diagram , The RS switch is a press and hold switch , and the Enable switch is amomentary switch. There is a capacitor across The Enable switch for debouncing.

Its not very convenient to have 8 wires and try to make them HIGH or LOW on breadboard. Hence , irecommend that you use a DIP switch along with 8 pin SIP connectors. This is the thing that i made forthe job :

Page 8: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 8/44

The DIP switch on a PCB

Page 9: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 9/44

The DIP switch connected to the LCD

The circuit is very simple and you need only 8 pull down resistors (1K) to make the circuit. You caneven use a SIP resistor pack to save space and soldering time.

Page 10: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 10/44

Circuit for wiring the DIP switch

I have mounted the DIP switch on quite a large PCB. You can make a small one if you want to

conserve space.

Download the PCB files from here and make your own DIP switch board.

Join together two female connectors to make a female-female connector. Solder a male connector on theLCD data pins.

Now that you are ready with the supporting hardware, lets get started with the real stuff.

Double check the connections

But first , before powering up the LCD , double check all these things.

1) No pins are shorting on the backside of the panel. (It can happen if you have not cleaned the boardafter soldering)

2) The contrast pin (3) (Vee) is correctly configured.

3) The backlight (pins 15 , 16) has a resistor in series to limit current.

Page 11: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 11/44

4) The DIP switch board is working properly.

5) The R/W pin is tied to ground.

6) The circuit is being powered by +5v. This is very important. Dont zap your LCD by accidentallypowering it with 12V.

7) The connector for connecting the 8 data pins from the DIP switch board to the LCD is proper.Double check for any loose wires and any mismatched wires on the connector.

Get started with the real stuff

The LCD showing my name

if you are sure that nothing is wrong with your setup , then go ahead and power up you LCD.

See nothing at all on the LCD? Dont panic. Thats what is supposed to happen.

Initializing the LCD

Page 12: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 12/44

To make the LCD show some signs of life , you need to issue an instruction to it. That instruction is00001111. Since you are giving an instruction to the LCD , you have to put it in instruction mode by

holding the RS pin to GND. In the board that you wired up, you can put RS at GND by pressing theRS push and hold button, such that it remains in a depressed state.

Now , your LCD is in instruction mode and is ready to accept any instruction that we issue to it. Now ,set the DIP switches as 00001111. This instruction tells it to turn on the display and show a blinkingcursor. Once , you have set the DIP switch to 00001111 , press the Enable momentary Button. You

should be seeing a blinking cursor on the screen now. This means that your LCD is initialized andready to accept characters to display.

Wait , you did not get a blinking cursor? Triple check if your connectors and switches are proper.Check if you have accidentally reversed the MSBs and LSBs on each side of the connector. Check yoursoldering to see if there are any cold solder joints.

Making characters show up on the display

Ok , once you have got the cursor blinking , the LCD will now accept character data to display. Now ,we have to put the LCD in character mode to make it accept characters to display. Press the RS switchto make it ‘undepressed’. Now set the DIP switches to 01000001 and then press the Enable button. Ifeverything has gone right , then you should be seeing a capital A on the screen. But what if you wantto display some other letter , like “M”? The procedure is the same , you only replace the 01000001 withthe code for M , which is 01001101. The LCD automatically increments the cursor position by 1

everytime you write a character. Try the same thing for “M” , M will appear to the right of A.

After you write to the last location of the first line , you would expect the LCD to automatically jump tothe second line. Sadly , it doesnt happen so. Using the second line is slightly more tricky. I’ll explainthat in a later post.

Using a µController with the LCD

It is quite a pain to manually do this procedure every time. Using µControllers to automatically sendthe data and the required signals simplifies the entire job. Here is a video that i took of the LCD beingcontrolled by a Attiny2313. It automatically writes my name continuously in a loop.

Page 13: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 13/44

Some additional stuff

Here is an online LCD simulator. Practice everything on it first before practically trying it on yourLCD.

Download the datasheet for the LCD JHD162A (which i’ve used in this tutorial).

Download the datasheet for HD44780 which is the chip that controls the LCD.

Here’s the instruction set for the LCD which i’ve copied and pasted from the LCD datasheet for yourreference :

Page 14: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 14/44

Instruction Set for the LCD

Here’s the character code table for the LCD which shows the corresponding binary values for eachcharacter :

Page 15: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 15/44

Character Table for the LCD

Thats it , you now know how to use an LCD!! Have fun playing with your LCD module !!

68 Comments on “[Tut] – Using HD44780 based LCDs – JHD162A”

1. Using LCDs « Suhas’s Blog says:

Page 16: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 16/44

April 7, 2009 at 3:16 am[...] Using LCDs [...]

Reply

2. jafar says:April 16, 2009 at 3:43 pmsir,

I am using same lcd but i m not able adjust contrast for lcd. pot is 10k…i am doing this in 8051development board only. plz tell me how to adjust contrast and what is value for that. i am waitingfor reply….

plz sir,

Reply3. iamsuhasm says:

April 17, 2009 at 1:56 amTry shorting the adjust pin directly to ground. Black squares should appear on your LCD top panel(and bottom panel if you have enabled dual mode). This will confirm if your LCD is proper.

How have you connected the 10K pot? I did not use a pot at all , but instead i used a variableresistor (2.2K) connected in series with the contrast pin and ground. That seemed to work just aswell.

Why dont you try that?

Reply4. Amit says:

May 12, 2009 at 5:43 amI tried shorting the adjust pin to ground and only some of the boxes got black while others did not,does this mean lcd does not work or it works only partiallyWill the remaining blocks display anything.

Replyiamsuhasm says:

May 12, 2009 at 6:00 amIf you short the adjust pin , then only the top row blocks will darken. The bottom row boxes willnot change. This is normal behavior. If this is what is happening with your LCD , then nothing’swrong.

Reply5. ar says:

May 12, 2009 at 3:27 pmconnect adjust pin to +5 V and not ground, this will set maximum contrast..

Reply6. iamsuhasm says:

Page 17: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 17/44

May 13, 2009 at 2:16 am@Ar ,If you connnect the contrast pin directly to Vcc , then it will be minimum contrast , not maximum.Maximum contrast is at ground. For optimum contrast , the contrast pin must be set to around 1V.You can put a 10K pot and twiddle along with the voltage until you get the contrast required.

Reply

7. gaurav ahuja says:June 30, 2009 at 8:20 pmHey the link to JHD162A datasheet isnt working could you please mail me the datasheet atg********[email protected]

Replyiamsuhasm says:

July 1, 2009 at 2:05 amSure. I’ve emailed it to you.

Reply8. Gaurav Ahuja says:

July 14, 2009 at 7:44 pmHi ive been trying for so many days to get my LCD JHD162A to work. But it doesnt seem to work.

All i see is two black lines. i am using atmega8 and the LCD in 4 bit mode with the followingconnections:DB4 -> PC0DB5 -> PC1DB6 -> PC2DB7 -> PC3RS -> PB1

RW -> PB2E -> PB3

If possible please email me the C program for it, or the initialisation sequence.

Reply9. Lands says:

July 16, 2009 at 6:19 pmi want to know how to clear the display?

Replyfarrukh says:

September 4, 2009 at 8:55 amyou can clear the display by sending 00000001 or 0x0F in hex

http://www.8051projects.net/lcd-interfacing/commands.phpthis page has all the commands

Reply10. prince garg says:

Page 18: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 18/44

July 29, 2009 at 10:58 pmi am having a typical problem. It seems as if the columns of font table have interchanged. If i try to

print the fonts of column 4 (P,Q,R,S,T,U,V,W.X,Y,Z….),what i get on the lcd is column number 3(@,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O).On the other hand, fonts of column 3 are coming as theyshould.. I m using pic 16f917. Please reply to my query…

Reply11. farrukh says:

September 4, 2009 at 8:53 am

hey thanks a lot for the tutorial, i used a 8051 instead of the manual circuitry but your conceptshelped a lot. i had been stuck with the lcd for a couple of days and your blog cleared a lot ofthings…:D

Reply12. chandresh says:

September 20, 2009 at 1:06 pm

can i use some other variable voltage supply for contrast adjustment?And can i see the display if i connect it to direct Vcc?

Reply13. Darshan says:

September 27, 2009 at 1:06 pmHi Suhas,We have written the following code for displaying the message on JHD162A LCD using AT89S52

uc.Are there any bugs in the program.Please help us.Can u reply me on my mail. [email protected]

#include#include#include

void lcdcmd (unsigned char value);void lcddata (unsigned char value);void MSDelay (unsigned int time);void DispMsg (char *Disp);void DispChar (char CHAR);sfr ldata=0×80;sbit rs=P2^0;

sbit rw=P2^1;sbit en=P2^2;void main (){unsigned char str [20], str1 [20];int a, b, total;a=2; b=5;

total=a*b;

Page 19: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 19/44

P0=0×00;sprintf(str1,”TRAIN IS COMING “);strcpy (str,”*HITECH COLLEGE*”);lcdcmd (0×38); //2line 5×7 matrixMSDelay (25);

lcdcmd (0x0E); //MSDelay (25);lcdcmd (0×01);MSDelay (25);lcdcmd (0x0F);MSDelay (25);//lcdcmd (0×06);

//MSDelay (25);//lcdcmd (0×86);lcdcmd (0×80);MSDelay (25);DispMsg (str1);// lcdcmd (0xc5);lcdcmd (0xc0);

MSDelay (25);DispMsg (str);MSDelay (250);MSDelay (2500);}void lcdcmd (unsigned char value){

ldata=value;rs=0;rw=0;en=1;MSDelay (1);en=0;return;

}void lcddata (unsigned char value){ldata=value;rs=1;rw=0;

en=1;MSDelay (1);en=0;return;}void MSDelay (unsigned int itime)

Page 20: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 20/44

{unsigned int i,j;for(i=0;i<itime;i++)for (j=0;j<100;j++);}void DispMsg (char *Disp){

while (*Disp)DispChar (*Disp++);}void DispChar (char CHAR){lcddata (CHAR);}

Reply14. Aditya says:

October 26, 2009 at 1:44 pmHey,

Very good tutorial and a startup guide. The Datasheet link is not working… Could you pleaseupload the datasheet on your server or email it to me?

Aditya

Reply15. LCD not working says:

March 16, 2010 at 1:08 pm[...] may consider taking a look at this link to get a good understanding of the LCD, I find it is

simpler to use in 4 bit mode. Here is an [...]

Reply16. Stankiewicz says:

April 25, 2010 at 5:40 amHi! I have the same LCD screen. But it doesn’t turn on his backlight. can it be broken?

Reply17. Pramanik says:

May 21, 2010 at 12:52 amSirI am a beginner in this field. I have purchased GDM1602A LCD. Could any one please tell me howto add/ use counter with the LCD GDM1602A or JHD162A LCD.Pramanik

Reply18. rohit says:

May 22, 2010 at 2:21 pm

Page 21: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 21/44

I am looking for an LCD without an in-built LCD controller. So that I could use ATMEGA169 asthe LCD controller to control it. I have searched a lot and I am not finding one.

Reply19. noe says:

May 26, 2010 at 11:20 pmhola

tengo una duda los orificios que tiene del lado izquierdo no se utilizan???

Reply

20. Abhi says:June 10, 2010 at 11:48 amhow to display characters on the second line of the lcd i m using jhd 162a and at89s52 uc.thank you

Reply21. ABHIKRANT says:

June 22, 2010 at 5:56 pm

thank you very much for the blog…it realy helped me to display alphabets on the lcd…

Reply22. abhikrant says:

June 25, 2010 at 10:29 amthank u very much for the blog…

i would like to know how to shift the cursor to the next line…plz can u mail me something at [email protected]

Reply23. Avisek Dasgupta says:

June 25, 2010 at 1:41 pmi have successfully displayed what i want on the lcd 1st row but not able to display anything on the

2nd line…please help..plz let me know the instruction to take the cursor to the 2nd line.

ReplySandy says:

August 13, 2011 at 3:04 pmJust send 0×80 as an instruction to the LCD. That should bring the cursor to the beginning of the2nd line. The span of the 2nd is usually from 0×80 to 0x8F for a 16×2 or 16×4 display.

Reply24. akshay says:

July 1, 2010 at 6:11 amsir,i am trying to interface the same lcd jhd 162a with my 89c51 but i get no characters on the lcdscreen..i am howeer able to see the contrast blocks..

Page 22: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 22/44

can u explain it to me?

Reply25. bucuresti says:

July 9, 2010 at 10:47 amBe successful and, Also unlike traditional?Einem Anbieter Ein, of Mother Natures.You to become,

with significant amounts.Programs are Google bucuresti, Rate The figure weeks of following.Rougeprofess of, of insurance in.,

Reply26. kunal says:

August 31, 2010 at 4:58 pmvery good discription.

i have using 89c51 microcontroller to interfacing lcd jhd 162a.plz send me assembly code for 4bit mode.

Reply27. yeshasvi says:

September 3, 2010 at 1:31 pmdude can we solder the LCD . Will it not damage the LCD module ?

Reply28. nachiket says:

September 23, 2010 at 6:53 pmhey,my problem is that…after the connections are done the LCD lights up and shows a test screen with16cols in the 1st line all dark after this nuthing happens whatsoever.

m using LCD JHD162A connected to my parallel port and try 2 clear the display using the givencommands acc. 2 d datasheet it dusnt clear the screen nor it prints nething on d LCD.also i tried to clear the screen and blink the cursor, but with no luck! m using VS2008, and WinXP.can ne1 seem 2 figure out the prob? Thx in anticipation-regards!

Reply

29. Sunil says:October 13, 2010 at 8:15 amI have interfaced JHD 162A Display with atmega32 but there is a problem in writing the commandsto lcd because lcd dispalys nothing.Please help me.

Reply

30. Jeffrey says:October 24, 2010 at 7:49 amhi, I have try to use this LCD with PIC16f84A. But after I wrote my program into the pic, it oni geta single black square line, another line is empty.my hardware connection is:port B = DB0-7

Page 23: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 23/44

RA0 = RS

RA1 = R/WRA2 = EVEE = Groundmy program is as shown as below:

//==========================================================================================// Author : Cytron Technologies

// Project : SK18B (18 pin Starter Kit)// Description : Using PIC16F628 for LED Blinking//==========================================================================================

// include//==========================================================================================#include

// Configuration//==========================================================================================__CONFIG (0x3F22); //configuration for the microcontroller

// Define I/O Pins//==========================================================================================#define lcd PORTB#define RS RA0#define EN RA1

// Function prototype (every function must have a function prototype)

//==========================================================================================void e_pulse(void);void delay(unsigned short i);void send_char(unsigned char data);void send_config(unsigned char data);void lcd_goto(unsigned char data);

// Main function (main fucntion of the program)//=========================================================================================void main(void){//set I/O input outputTRISA = 0b00000000;TRISB = 0b00000000;

while(1){send_config(0b00000001); //clear display at lcdsend_config(0b00000010); //Lcd Return to home

Page 24: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 24/44

send_config(0b00000110); //entry mode-cursor increase 1send_config(0b00001100); //diplay on, cursor off and cursor blink offsend_config(0b00111000); //function set

lcd_goto(0); //cursor start from beginning

//display character on LCDsend_char(‘ ‘);

send_char(‘T’);send_char(‘E’);send_char(‘M’);send_char(‘P’);send_char(‘.’);send_char(‘A’);send_char(‘=’);

lcd_goto(20); //cursor go to 2nd line of the LCD

//display character on LCDsend_char(‘ ‘);send_char(‘T’);send_char(‘E’);

send_char(‘M’);send_char(‘P’);send_char(‘.’);send_char(‘B’);send_char(‘=’);}}

//========================================================================// Function//========================================================================void delay(unsigned short i){for(;i>0;i–);

}

void send_config(unsigned char data){RS=0;lcd=data;delay(500);e_pulse();}

void e_pulse(void)

Page 25: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 25/44

void e_pulse(void){EN=1;delay(500);EN=0;delay(500);}

void send_char(unsigned char data){RS=1;lcd=data;delay(500);e_pulse();

}

void lcd_goto(unsigned char data){if(data<16){send_config(0×80+data);}else{data=data-20;send_config(0xc0+data);}}

ReplyJeffrey says:

October 24, 2010 at 7:52 amsorry, wrong code attached. this is my modify code.//==========================================================================================// Author : Jeffrey// Project : LCD test// Description : Using PIC16F84A for LCD display//==========================================================================================

// include//==========================================================================================#include

// Configuration//==========================================================================================__CONFIG (0x3FF); //configuration for the microcontroller

Page 26: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 26/44

// Define I/O Pins//==========================================================================================#define lcd PORTB#define RS RA0#define RW RA1#define E RA2

// Function prototype (every function must have a function prototype)//==========================================================================================void e_pulse(void);void delay(unsigned short i);void send_char(unsigned char data);void send_config(unsigned char data);

void lcd_goto(unsigned char data);

// Main function (main fucntion of the program)//=========================================================================================void main(void){//set I/O input outputTRISA = 0b00000000;TRISB = 0b00000000;

//Initial Conditiondelay(50000);

send_config(0×02);

send_config(0×38);send_config(0x0E);send_config(0×06);

lcd_goto(0);send_char(‘H’);send_char(‘E’);send_char(‘L’);send_char(‘L’);send_char(‘O’);

}

//========================================================================// Function

//========================================================================void delay(unsigned short i){for(;i>0;i–);}

Page 27: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 27/44

void send_config(unsigned char data){RS=0;lcd=data;delay(5000);e_pulse();}

void e_pulse(void){E=1;delay(5000);E=0;delay(5000);}

void send_char(unsigned char data){RS=1;lcd=data;delay(5000);e_pulse();

}

void lcd_goto(unsigned char data){if(data<16){send_config(0×80+data);}else{data=data-20;send_config(0xc0+data);}}

Reply31. parth temkar says:

November 15, 2010 at 2:53 pmhi , dear suhas sir

i have one big problem that in this video you had shown some extra circuit on bear-board is thisthing required????

plz reply me sir plz

Page 28: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 28/44

parth temkar

Reply32. mutha50 says:

November 17, 2010 at 10:20 pmSir,

Thank you very much for this tutorial about LCD.I am using a 4×20 HD44780 compatible too on an ATMega16 Microcontroller but i don’t get hemwork.It’s now 4 weeks that i’m trying to figure out what ‘s wrong with my LCD without succes.Here are my connections in 4bit mode:

D4->PC0D5->PC1D6->PC2D7->PC3E->PC5

RS->PC4

LED-,D0,D1,D2,D3,R/W,VSS are grounded on original board.The backlight and the contrast pot (I get two lines with 20 black boxes each on display)are workinggood.I tested the LCD on a Microprocessor and it works.I also used my Microcontroller to program a serie of LEDS and it works.The two C-program that i am trying to use to drive my LCD,have been used on the other ATMega16 Microcotnroller with succes.So, guys if you have any idea of what’s going on with my LCD please help me.

Thanks in advance for your time.

Reply33. Master Kire says:

November 25, 2010 at 4:30 amthx a lot… ur post is so perfect that I almost forgot it was in english, now I got my LCD workingpretty good for the arduino!!!

Reply34. Ed says:

February 19, 2011 at 4:50 pmThanks, I finally got this working this morning!

Now it’s on to the Arduino!

Ed

Reply

Page 29: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 29/44

35. isaketh says:February 24, 2011 at 7:15 amheyy suhas….ur blog is quite useful …thanx dude

Reply36. tejesh rao r b says:

March 14, 2011 at 2:45 pmhi,im a BE student and im using lpc2148 to display….the following is my code…i followed yourconcept but nothing is coming in lcd…its the same lcd which you used……

#include#include

void lcdready(void);void lcdcommand(void);void lcddatawrt(void);

void lcd_amber(void);void delay(void);void delay1(void);void lcd_initialization(void);

unsigned int n,i,j,x,r;

int main (void) {

IODIR1 = 0x00FF0000;IODIR0 = 0×70000000;PINSEL1=0×00000000;lcd_initialization();while (1){

delay1();lcd_amber();delay1();

}}void delay(void){for(i=0;i<=62270;i++)for(j=0;j<=62270;j++);}

void delay1(void){int i;

char k;

Page 30: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 30/44

for(k=0;k<=8;k++){for(i=0;i<=400000;i++) ;}}void lcdcommand(void){lcdready();IODIR1=0X00FF0000;

IOPIN1 = n;IOCLR0=0×10000000;IOCLR0=0×20000000;IOSET0=0×40000000;IOCLR0=0×40000000;}void lcddatawrt(void){lcdready();IODIR1=0X00FF0000;IOPIN1 = n;IOSET0=0×10000000;IOCLR0=0×20000000;IOSET0=0×40000000;

IOCLR0=0×40000000;}void lcdready(void){ IODIR1=0X007F0000;IOSET1=0×00800000;IOCLR0=0×10000000;IOSET0=0×20000000;while((IOPIN1&0×00800000)== 0×00800000){IOCLR0=0×40000000;IOSET0=0×40000000;}}

void lcd_initialization(void){PINSEL1=0×00000000;PINSEL2=0×00000000;n=0×00380000;lcdcommand();n=0x000c0000;lcdcommand();n=0×00060000;

Page 31: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 31/44

lcdcommand();n=0×00010000;lcdcommand();

}

void lcd_amber(void){while(1){n=0×00800000;//startlcdcommand();n=0×00540000;lcddatawrt();n=0×00650000;lcddatawrt();n=0x006d0000;lcddatawrt();n=0×00700000;lcddatawrt();n=0×00650000;

lcddatawrt();n=0×00720000;lcddatawrt();n=0×00610000;lcddatawrt();n=0×00740000;lcddatawrt();n=0×00750000;lcddatawrt();n=0×00720000;lcddatawrt();n=0×00650000;lcddatawrt();n=0x00c00000;//start

lcdcommand();n=0×00200000;lcddatawrt();n=0×00200000;lcddatawrt();n=0×00200000;lcddatawrt();n=0×00200000;lcddatawrt();n=0×00200000;lcddatawrt();n=0×00200000;lcddatawrt();

Page 32: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 32/44

n=0×00200000;lcddatawrt();n=0×00200000;lcddatawrt();n=0×00200000;lcddatawrt();n=0×00200000;lcddatawrt();n=0×00530000;lcddatawrt();n=0×00650000;lcddatawrt();n=0x006e0000;lcddatawrt();

n=0×00730000;lcddatawrt();n=0x006f0000;lcddatawrt();n=0×00720000;lcddatawrt();n=0×00900000;//startlcdcommand();n=0×00540000;lcddatawrt();n=0×00450000;lcddatawrt();n=0x004d0000;lcddatawrt();

n=0×00500000;lcddatawrt();n=0×00200000;lcddatawrt();n=0x003d0000;lcddatawrt();

}

}i dont knw whats wrong please help me

Reply37. tejesh rao r b says:

March 14, 2011 at 2:48 pm

sorry its#include#include

Page 33: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 33/44

Reply38. tejesh rao r b says:

March 14, 2011 at 2:49 pmive removed brackets#include stdio.h#include LPC21xx.H

Reply39. sid says:

April 28, 2011 at 2:28 am

Excellent info. Can you please send me some link or the code in visual basic 6 to see the mousemove coordinates on LCD.

Reply40. Mayank Sharma says:

June 18, 2011 at 11:07 amAwesome bro just awesome tut bt plzzz upload the code alsooo so tat we can have an idea abt howto use it with ATMEGA 16 ….. regards Mayank Sharma

Reply41. Abraham says:

June 27, 2011 at 2:16 pm@Suhas:Thanx a ton,man!!! I dreaded the LCD and ur tutorial helped me a lot!!!@Farrukh: The link you gave in reply to post 9 is also awesome….:)

@Avisek: You could look into Farrukh’s link or check the code snippet from my code….:)…….……..void gotopos(int line,int pos){char data;(line==1)? (data=0×80):(data=0xC0); //Top line DDRAM address starts from 0×80 and 2nd line from0xC0data +=pos;P1OUT &=~RS;P1OUT |=EN;senddata(data); //Send the cursor positionP1OUT &=~EN;P1OUT |=EN;

}…….…….Here RS is a macro having the bit no of the bit RS pin of LCD is connected to, so is EN (macro forENABLE pin). I have pulled RW to ground as I don’t intend to read the busy flag. In case you haveRW connected to another I/O pin, then pull the pin to ground.

Page 34: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 34/44

All the best….:)Btw…due to pin constrains I had to use a shift register to parallel load the data onto LCD…In otherwords, senddata() ensures that the data is recieved by DBx…:)

For those still unsure…………

………..void senddata(char data){int i=0;while(i<8){++i;(data & BIT7)? (P1OUT |=DAT) : (P1OUT &=~DAT) ; //The data is transfered bit by bit taken frombit 7 of dataP1OUT |=CLK; //Clock of the shift register pulled highwait(1); //Wait for 1 msP1OUT &=~CLK; //Transfer to the serial register overdata<<=1; //The data is left shifted to tackle the next bit}

}………

Reply42. jhd162a lcd related question says:

July 11, 2011 at 7:43 pm[...] [...]

Reply43. sugunachand says:

July 30, 2011 at 4:58 amI am new to both electronics and software. But after seeing this interested to learn some thing sincethe blog providing basic idea of LCD display working. Thank you very much.

Reply44. connecting jdJHD162A with the o/p of at89s52 says:

August 19, 2011 at 1:24 am[...] direction. Post your language of preference so we can help you further. BigDog Tutorial: UsingHD44780 based LCDs – JHD162A Reply With Quote View Profile + Post New Thread + Reply toThread [...]

Reply45. bid says:

September 18, 2011 at 7:54 pmthanks, been stuck with that lcd for long time.

Reply

Page 35: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 35/44

46. singG says:November 22, 2011 at 6:43 pmHello Suhas I have these 2 programs which I intend to run on the board (http://www.nskelectronics.in/files/8051_project_board.pdf ).Please let me know how toexecute these….please let me know where I am going wrong …thanks

/**********************************PROGRAM 1***************************///Please note the LCD used in this board is JHD162A

#include

sbit EN = P3^4 ;sbit RS = P3^5;//sbit RW = ; //not mentioned on the schematic

void delay();sfr P1_data = 0×90; //data lines are connected to LCD from port P1 – as per the circuitvoid delay(void);

void cmd(){RS = 0;//RW = 0;EN = 1;EN = 0;delay();}

void write_lcd(){RS = 1;//RW = 0;EN = 1;EN = 0;

delay();}

void init_lcd(){P1_data = 0×38;cmd();P1_data = 0×01;cmd();P1_data = 0x0c;cmd();P1_data = 0×86;cmd();

Page 36: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 36/44

P1_data = 0xdf;write_lcd();

P1_data = 0×51 ;write_lcd();

}

void delay(){int i,j;

for(i = 0; i< 75 ; i++)for(j = 0; j < 75 ; j++);}

void main(){for(;;)init_lcd();}

/**********************************************PROGRAM 2 *************************************/#include#include#include

//ANSI STYLE PROTOTYPEvoid lcddata( unsigned char value);void lcdcmd( unsigned char value);void Delay( unsigned int itime );

//SFR names declarationssfr lcd_port = 0×90;sbit RS = P3^5;sbit EN = P3^4;//sbit RW =

void main(void){unsigned int i,k = 0; //Delay variable

char j = 0; //LED variableunsigned char l[10] = {0×38,0x0E,0×06,0×01,0×41};//unsigned char l[10] = {0×38,0×01,0×80};char str[] = “Helloworld”;char str1[] = “welcome”;char *p; //pointer declarations

Page 37: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 37/44

for(i = 0 ;i< 3 ; i++)lcdcmd(l[i]); //sending basic LCD commands to LCD

for( p = str; *p ;p++)lcddata(*p);

lcdcmd(0xC0); //0xC0 command for displaying on second line

for( p = str1; *p ;p++)lcddata(*p);

do{ //infinite loop for LCD scrollinglcdcmd(0×18); //0×18 command for LCD scrollingDelay(50);}while(1);}

void Delay( unsigned int itime){int i,j;for( i = 0; i < itime ;i++)

for( j = 0; j < 1275; j++);}

void lcdcmd( unsigned char value ){lcd_port = value;RS = 0; //register select = 0 for command modeEN = 1; //latch enable = HIGH_nop_();EN = 0; //latch enable = LOWDelay(10);return;}

void lcddata( unsigned char value )

{lcd_port = value;RS = 1; //register select = 0 for command modeEN = 1; //latch enable = HIGH_nop_();EN = 0; //latch enable = LOWDelay(10);return;}

Reply

Page 38: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 38/44

47. exam says:December 13, 2011 at 7:11 pmThank you so much.you are realy help methank you again

Reply48. qaisar azeemi says:

January 12, 2012 at 9:32 amhi;i want to display the following data on my lcd screen.

volts(V) Amps()9.0 3.0

it is displaying on the proteous simulator well but when i tried it to disply practically on hardware itjust displayd first line with second line blank

i am using 89c52 microcontroller and JHD 162A LCD 16×2 display. i am using assembly toprogram it. Following is my code:

;………………program for LCDDisplay………………………………………………………………………………………………RS BIT P2.0RW BIT P2.1E BIT P2.2

ORG 00H

MAIN: MOV DPTR, #MYCOM

C1: CLR AMOVC A,@A+DPTRACALL COMNWRT ; call command subroutienACALL DELAY ; GIVE LCD some time to process

INC DPTRJZ SEND_DATASJMP C1

SEND_DATA: MOV DPTR,#MYDATA_1D1: CLR AMOVC A,@A+DPTRACALL DATAWRT ; Call data subroutienACALL DELAYINC DPTRJZ NEXTSJMP D1

Page 39: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 39/44

[b]NEXT: MOV A,#06H ; i think problem is in this routineCALL COMNWRTCALL DELAY

MOV A,#0C2HCALL COMNWRTCALL DELAY

MOV A,#10011001B ;4,,,12VCALL FORM_DATA

MOV A,#0C9H

CALL COMNWRTCALL DELAY

MOV A,#01100110B; 1,,, 3ACALL FORM_DATA

SJMP $[/b]

FORM_DATA: ; im skiping mathamatical manipulations here for simplicity.

DISPLAY: ADD A,#48 ; Convert data to ASCII codes and sent to lcd for displayMOV P0,ACALL DATAWRTCALL DELAYRET

COMNWRT: MOV P0,A ;Send command to lcdCLR RS ; RS=0 for command registerCLR RW ; R/W=0 for writeSETB E ; E=1 for high pulseACALL DELAYCLR E ;E=0 FOR low pulse

RET

DATAWRT: MOV P0,A ;Copy data to port 1SETB RS ; RS=1 For data registerCLR RWSETB E

ACALL DELAYCLR ERET

MYCOM: DB 38H,0CH,01H,06H,80H,0 ; COMMANDS

MYDATA_1: DB “VOLTS(V) AMPS(A)”

Page 40: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 40/44

DELAY: MOV R3,#50HERE2: MOV R4,#255HERE: DJNZ R4, HEREDJNZ R3, HERE2

RET

i will be very thankfull to you for your help.

RegardsQaisar Azeemi

Reply49. lam says:

February 1, 2012 at 4:37 pmDear iamsuhasm..First Thank you so much for your time make this site ,its very helpful for me to learn and knowhow make LCD work.Could you help me to know is possible to rewrite this code please :customChars[0] = Array(0, 4, 2, 31, 2, 4, 0, 0);to word (A), and how is call this code ie: hex..binaire ???and how converter this code. Thank you in advance your time.Sorry for my English andunderstand very littler in word computer .

Best regardslam

Reply50. Charles says:

February 2, 2012 at 9:52 pmIs the RS supposed to be high or low for instruction mode? You have contradictory informationabout this above.

Thanks

Reply51. Manu M says:

February 5, 2012 at 5:52 pm

Thank you very much. Heavenly thanks. I didn’t tried. But i owe you. Thanks

Reply52. sneha says:

March 19, 2012 at 9:26 ami have a problem with pic18f46j11 controller.while doing programming, i got command execution correctly but data has not been displayed.

can u please suggest me any solution for this???

Reply

Page 41: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 41/44

53. Katende Allan says:March 21, 2012 at 9:01 ami need some help,i have just bought a JHD162A LCD,and have tried interfacing it with arduino butall in vain,tried every possible thing but cant get it to display anything,I connected it exactly likethis and ran the hello world code,but am just getting the backlights lighting,no display text on thescreen,i have tried grounding pin 5 of the LCD,still nothing,please help me get out of this state of

quagmire,i have been doing the same circuit since yeaterday,at first i thought i had made a mistakein the connection,then i re-did everything but the same.I even thought i bought a faulty LCD,thenwent back and bought a new one but all the same.

ReplyKatende Allan says:

March 21, 2012 at 9:01 ammy email is [email protected]

Reply54. sameer thapa says:

March 22, 2012 at 7:04 amcan any1 tell me hw we can type message in lcd ,i hav work with the code also but cant get……….

Reply

55. » Controlling a HD44780 LCD on a Beaglebone (Part 1) Wunderkammer says:March 22, 2012 at 3:57 pm[...] if you would like to know more about controlling these LCD devices I suggest this website, andthe article “How to use intelligent L.C.D.s – Part One” by Julyan llett, [...]

Reply56. khushal says:

March 24, 2012 at 10:18 amexcellent tutorial.I tried it on cyclone IV nano board.

Reply57. Ricardo says:

March 27, 2012 at 2:00 amHi,

I think you have an error on this tutorial…

RS = HIGH means writeRS = LOW means command..

just need to switch it

ps: thank you for this tutorial!

Reply58. udit daga says:

March 28, 2012 at 6:52 pm

Page 42: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 42/44

void main(){DDRD=0xFF;DDRB=0xFF;PORTD=0b00000001;PORTC=0b00000100;PORTB=0b00110000;clear_bit(PORTC,2);_delay_ms(5);set_bit(PORTC,2);_delay_ms(5);

PORTB=0b00001110;

clear_bit(PORTC,2);_delay_ms(5);set_bit(PORTC,2);_delay_ms(5);

PORTB=0b00000110;clear_bit(PORTC,2);_delay_ms(5);set_bit(PORTC,2);_delay_ms(5);

set_bit(PORTC,0);PORTB=0b01010101;clear_bit(PORTC,2);

_delay_ms(5);set_bit(PORTC,2);_delay_ms(5);

PORTB=0b00000110;clear_bit(PORTC,2);_delay_ms(5);set_bit(PORTC,2);_delay_ms(5);

clear_bit(PORTC,0);PORTB=0b00010100;clear_bit(PORTC,2);_delay_ms(5);

set_bit(PORTC,2);_delay_ms(5);

set_bit(PORTC,0);PORTB=0b01000100;clear_bit(PORTC,2);

Page 43: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 43/44

_delay_ms(5);set_bit(PORTC,2);_delay_ms(5);

clear_bit(PORTC,0);PORTB=0b00010100;clear_bit(PORTC,2);_delay_ms(5);

set_bit(PORTC,2);_delay_ms(5);

set_bit(PORTC,0);PORTB=0b01001001;clear_bit(PORTC,2);_delay_ms(5);set_bit(PORTC,2);_delay_ms(5);

clear_bit(PORTC,0);PORTB=0b00010100;clear_bit(PORTC,2);_delay_ms(5);set_bit(PORTC,2);

_delay_ms(5);

set_bit(PORTC,0);PORTB=0b01010100;clear_bit(PORTC,2);_delay_ms(5);set_bit(PORTC,2);_delay_ms(5);}

this is the code that im using with an interface of atmega 16could you suggest if there are any bugs in the codeconnections: b0-b7:port bd0:enable

d1:RWd2:RS

Reply59. Gouresh says:

May 11, 2012 at 6:38 amHi Suhaas,i need to interface JHD 162A LCD to AT89S51 MCU and display string and a pulse count.It initially worked very well, I could see the string as well as the count value. But when i tried theprogram next day, the LCD shows black boxes. I tried changing the MCU, but the new MCU also

Page 44: LCD Tutorial

7/10/13 [Tut] – Using HD44780 based LCDs – JHD162A | Suhas's Blog

iamsuhasm.wordpress.com/tutsproj/using-lcds/ 44/44

gave required output, but failed after 2nd attempt onwards. Can anyone figure out what might bethe fault.I trust the circuit and the code as well, since it worked well initially.I have tried the following

1) ground the pin3 of the LCD.2) using delay before giving any commands.Please suggest something. Thanking in advance.Gouresh [email protected]

Reply60. Gouresh says:

May 11, 2012 at 6:51 amcorrection in email [email protected] alot

Reply

61. kevham says:June 20, 2012 at 7:31 pmhi suhas.. u hv given a very valuable information…I want to interface LCD JHD 162A with MSP430g2231…i hv tried many times..it doesnt work out..Could u pls help me to get a successful output???

Reply62. Chris Birkett says:

July 23, 2012 at 11:09 pmThis is fantastic, thank you. First line works perfectly – but how do you get to the second? Googlinghasn’t helped me so far and you don’t appear to have written your second article yet

Reply

Blog at WordPress.com. The Clean Home Theme.


Recommended