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 interfacing problem

Status
Not open for further replies.

ramyadhadidi

Junior Member level 1
Joined
Jan 12, 2012
Messages
17
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,412
I have problems with interfacing LCD with AT89C52, I read all posts but...won't help me

this is my assembly code
Code:
LCD:		        MOV A,#38H			;write LCD
			ACALL COMNWRT
			ACALL DELAY2
			MOV A,#0EH
			ACALL COMNWRT
			ACALL DELAY2
			MOV A,#01H
			ACALL COMNWRT
			ACALL DELAY2
			MOV A,#06H
			ACALL COMNWRT
			ACALL DELAY2
			MOV A,#84H
			ACALL COMNWRT
			ACALL DELAY2
			
			MOV A,#'X'
			ACALL DATAWRT
			ACALL DELAY2
			MOV A,#':'
			ACALL DATAWRT
			ACALL DELAY2
			MOV A,R3
			ACALL HEX2ASCH
			ACALL DATAWRT
			ACALL DELAY2
			MOV A,R3
			ACALL HEX2ASCL
			ACALL DATAWRT
			ACALL DELAY2
			
			
			;MOV A,#0CAH
			;ACALL COMNWRT
			;ACALL DELAY2
			;ACALL DELAY2
			MOV A,#'Y'
			ACALL DATAWRT
			ACALL DELAY2
			MOV A,#':'
			ACALL DATAWRT
			ACALL DELAY2
			MOV A,R2
			ACALL HEX2ASCH
			ACALL DATAWRT
			ACALL DELAY2
			MOV A,R2
			ACALL HEX2ASCL
			ACALL DATAWRT
			ACALL DELAY2
			RET
COMNWRT:	        MOV LCDDB,A		;for writing LCD commands
			CLR RS
			CLR RW
			SETB E
			CLR E
			RET
			
DATAWRT:	        MOV LCDDB,A		;for writing LCD datas
			SETB RS
			CLR RW
			SETB E
			CLR E
			RET	

;READY:		SETB P1.7
;			CLR RS
;			SETB RW
;AGAIN1:		CLR E
;			SETB E
;			JB P1.7,AGAIN1
;			RET
delay2 is 25ms

I change my code in some way, it is correct in PROTEUS but when I conncet it to LCD (JHD162A) I see many problems:
characters isn't correct.
I have 2 lines but on second line nothing is written.
checking busy flag does't work. I see nothing.
reset button on my 89c52 doesn't reset LCD.

and very serious problem, LCD is very dependent to power, I regulate power with capacitor and diode it got better but not solved.
also it is very dependent to the way i conncet power!

I try this on university with better equipment but I have same problem

please help me,is code correct?
and if it is correct why I have these problems with all LCDs?
 

have a look in your lcd datasheet... and compare timing between commands in initialisation (8bits or 4bits)...

hope it helps...
 

have a look in your lcd datasheet... and compare timing between commands in initialisation (8bits or 4bits)...

hope it helps...

I checked it, I have correct timing
 

LCDs require time to powerup in the real world, unlike a Proteus simulation.

Do you have a 100ms to 200ms delay before accessing the LCD at the start of your code?

Also post a schematic of your circuit, including your regulated power section.

Have you implemented the contrast control of the LCD?

BigDog
 

LCDs require time to powerup in the real world, unlike a Proteus simulation.

Do you have a 100ms to 200ms delay before accessing the LCD at the start of your code?

Also post a schematic of your circuit, including your regulated power section.

Have you implemented the contrast control of the LCD?

BigDog

Yes I put 500ms delay before starting my work with LCD

I put schematic here, my power regulator is simple, must I have one in my circuit?

about contrast, I can adjust it very well with a pot



and another question, can I use one 12Mhz crystal to run 8051s? and how to connect it if your answer is yes
 

COMNWRT: MOV LCDDB,A ;for writing LCD commands
CLR RS
CLR RW
SETB E
CLR E
RET

DATAWRT: MOV LCDDB,A ;for writing LCD datas
SETB RS
CLR RW
SETB E
CLR E
RET


Add small delay between clr rw and setb e and clr e
 

you are getting garbage data on lcd or none at all? Is the first like complete black?
Also post the complete practical circuit that you have implemented.....
 

you are getting garbage data on lcd or none at all? Is the first like complete black?
Also post the complete practical circuit that you have implemented.....

Not complete balck, it is random
sometimes I get what I want but after that garbage, e.g. "x=15y=15555555" 5s are garbage
somtimes all is garbage, e.g. "8888888888888888888"
and somtimes nothing appear

I post my circuit, first thing in my program is running LCD then waiting for interrupts, I connect ints to Vcc and also EA/VPP. XTALs are connceted with 30pfs and 12Mhz crystal. In the side of LCD I put a pot and can adjust contrast,all balck to nothing. This is my practical circuit for this part of my project.

My code is right?
I get confused why it isn't work well. Is my LCD damaged?

---------- Post added at 20:02 ---------- Previous post was at 20:00 ----------

no it's not complete balck, if I adjust contrast it will be
 

Reading all the posts, i feel there is some other part of the program is making trouble.

Another chance is hardware error, Check for both
 

just write a simple code to display 'hello world' on the lcd and check if its working.......maybe your other code (interrupt) is causing some problem...
 

Your PIN connections are as follow:-
RS ---> P2.0
RW ---> P2.2
EN ---> P2.1

Pls check these connection whether u have write the program considering these pins or not...

As u have not defined your pin configuration in the code given above...
Kindly Check that and report us back....

And can u upload your proteus design by zipping it..

before Doing so check connection i have told u

Hope this assist
 

Your PIN connections are as follow:-
RS ---> P2.0
RW ---> P2.2
EN ---> P2.1

Pls check these connection whether u have write the program considering these pins or not...

As u have not defined your pin configuration in the code given above...
Kindly Check that and report us back....

And can u upload your proteus design by zipping it..

before Doing so check connection i have told u

Hope this assist

It's not my first code!!! I certain about my pins

Nobody answer me what I need
 

Attachments

  • My Desktop.zip
    19.1 KB · Views: 59

Oh!! dear don't be angry
we are just trying to help u....

what else can be do just guessing the faults...

I am sorry... if that post of mine was redundant to u..
I was just trying to help u
 

Oh!! dear don't be angry
we are just trying to help u....

what else can be do just guessing the faults...

I am sorry... if that post of mine was redundant to u..
I was just trying to help u

I know, I didnt get angry
and I thanks for your post

I only want to know that did anybody experience sth like this?cause on our lab I encounter with same problem and no one didnt realize what is for
I thought it was LCD problem
But today when I impelement my circuit for my project I saw same problem. I really get confused about it.
I am going to get another LCD and probably not that chinese one that I have in two of my circuits.
I will tell you what happened

and also my ANOTHER question is (i dont want open another thread) can I run two 8051 with one crystal? if yes, how?
 

and also my ANOTHER question is (i dont want open another thread) can I run two 8051 with one crystal? if yes, how?

Connect the crystal to uC 1 as usual, and then connect Xtal2 of uC 1 to Xtal1 of uC 2. Xtal2 of uC 2 can be connected to next uC or just leave it (no connection).
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top