Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] LCD Initialization - JHD162A to AT89S52 (8051)

Status
Not open for further replies.

jimnics

Newbie level 4
Newbie level 4
Joined
Oct 8, 2008
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,357
hey guys, i am having some very trivial problem in my project. but i am just not able to debug it.

My circuit is very simple: 8051 based microcontroller (AT89S52) interfaced to 16x2 LCD Module (JHD162A).

The problem is :
When i power on my circuit, the expected result is that a welcome message should get displayed on the LCD. But actual result is that the LCD is not showing any such message. Instead the LCD simply shows (stable) black boxes in the 1st line. and nothing on the second line.

So, what can be the possible problem?? pls reply soon.

==========================
Note that i hav applied 0V (ground) to pin no. 3 (VEE)of LCD...... (contrast control pin).

P.S. The thing is my project was working very well 6 months ago..... but now its not working.....i hav used that same hardware and same software (program) ....
... so i am clueless as to what could be the problem here.....
 

hi

i think pin 3 is for contrast control pin and
thus variable voltage apply at this pin through Pot,
not 0 Voltage,

try this
 
  • Like
Reactions: shigha

    shigha

    Points: 2
    Helpful Answer Positive Rating
Hey I am also facing the same problem, the LCD shows only the black boxes on line 1 and nothing on line 2

Port 3 I have connected RS, E, RW. (0,1,2)
The data are connected on port 1

The LCD is not working, i dont know wht to do.
I am using Philips 89v51rd2, and SDCC compiler.

Please Help me
 

Hey I am also facing the same problem, the LCD shows only the black boxes on line 1 and nothing on line 2

Black boxes are seen whenever the initialization is not proper. Check out timings in the initialization routine.

Post your code, we can find out the problem
 

Black boxes are seen whenever the initialization is not proper. Check out timings in the initialization routine.

Post your code, we can find out the problem

Thank you for your reply..

The current situation is that the LCD has started working, but the characters are not being the displayed in the proper way.

example:- T in displayed as U on the lcd

Various other characters are also being displayed in the same way..
Where is the problem??


#include<delay.h>
#include<p89v51rd2.h>

#define LCD_rs P3_0
#define LCD_rw P3_1
#define LCD_en P3_2

void LCD_busy()
{
unsigned char i,j;
for(i=0;i<50;i++) //A simple for loop for delay
for(j=0;j<255;j++);
}

void LCD_init()
{
P1 = 0x38; //Function set: 2 Line, 8-bit, 5x7 dots
LCD_rs = 0; //Selected command register
LCD_rw = 0; //We are writing in data register
LCD_en = 1; //Enable H->L
LCD_en = 0;
LCD_busy(); //Wait for LCD to process the command
P1 = 0x0F; //Display on, Curson blinking command
LCD_rs = 0; //Selected command register
LCD_rw = 0; //We are writing in data register
LCD_en = 1; //Enable H->L
LCD_en = 0;
LCD_busy(); //Wait for LCD to process the command
P1 = 0x01; //Clear LCD
LCD_rs = 0; //Selected command register
LCD_rw = 0; //We are writing in data register
LCD_en = 1; //Enable H->L
LCD_en = 0;
LCD_busy(); //Wait for LCD to process the command
P1 = 0x06; //Entry mode, auto increment with no shift
LCD_rs = 0; //Selected command register
LCD_rw = 0; //We are writing in data register
LCD_en = 1; //Enable H->L
LCD_busy();
}


void lcd_cmd(unsigned char var)
{

P1 = var; //Function set: 2 Line, 8-bit, 5x7 dots
LCD_rs = 0; //Selected command register
LCD_rw = 0; //We are writing in instruction register
LCD_en = 1; //Enable H->L
LCD_en = 0;
LCD_busy(); //Wait for LCD to process the command
}

void LCD_senddata(unsigned char var)
{
P1 = var; //Function set: 2 Line, 8-bit, 5x7 dots
LCD_rs = 1; //Selected data register
LCD_rw = 0; //We are writing
LCD_en = 1; //Enable H->L
LCD_en = 0;
LCD_busy(); //Wait for LCD to process the command
}

void LCD_sendstring(unsigned char *var)
{
while(*var)
{
LCD_senddata(*var++);
}
}

void main(void)
{
LCD_init();
lcd_cmd(0x38);
DELAY(10);
LCD_senddata('F');
LCD_senddata(':');
LCD_senddata('1');
}
 

The LCD is working fine, but not displaying characters in a proper manner

e.g.

ELECTRONICS IS DISPLAYED AS "EMECUSOOICS"

MOST OF THE CHARACTERS ARE NOT DISPLAYED.
I dont know what to do..
please help.
 

It seems to be a hardware problem. Check for dry solder, loose wire etc.
 

Hi


It looks like the issue is with data line 0, this looks like it is constantly high. If the ascii code is odd the character appears on the screen OK, if it is even it jumps to the next character up in the table.

HTH
 

Thanks for your reply guys,

I am checking the connections, maybe that should solve my problem.

Thanks alot.:grin:
 

supply given to the lcd should be well regulated. add capacitor and a diode to make the supply regulated otherwise your lcd display will be blurred or sometime it display unwanted chararters.
 

Thank you guys, i got the problem solved..
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top