Discussion in "8051 Discussion Forum" started by    anee    Apr 7, 2008.
Mon Apr 07 2008, 04:26 pm
#1
hey..me havin a similar prod as yun..my lcd displayed da required msg a couple of times...but thereafter its just da bars...i adjusted da contrast,tried programmin da chip again...but nothin...n i checked da voltages at da crystal input..they r fine..so da controller is ok...any suggestions...plz...this is urgent...i need to submit da proj in 3 days..

thanks in advance
Mon Apr 07 2008, 11:17 pm
#2
well, im using d following assembly language code in my project(using AT89S52),
if dis is wat u require, then hav a look, its working fine in my project




;LCD PORT DEFINITIONS
DATAPORT EQU P0
EN EQU P1.2
RW EQU P1.1
RS EQU P1.0
D7 EQU P0.7

ORG 0000h
LJMP MAIN


MAIN:

MOV DATAPORT,#0FFH
ACALL LCD216 ;LCD INITIALISATION
ACALL LCDCLR
ACALL RETHOME
ACALL DONCOFF ;LCD INITIALISED
ACALL LCDCLR
ACALL FCBFL
ACALL COMMAND
MOV DPTR,#TABLE15
ACALL WRITE
ACALL FCBSL
ACALL COMMAND
MOV DPTR,#TABLE25
ACALL WRITE
RET

TABLE15: DB 'RESULT MODE',0 ;U MAY WRITE HERE WATEVER U WAN2 DISPLAY
TABLE25: DB 'STARTING...',0








;LCD ROUTINES

CHKBUSY: ;Checks for the status of the LCD
SETB D7
CLR RS
SETB RW

LOOP:
CLR EN
SETB EN
JB D7,LOOP
RET

DISPLAY:
ACALL CHKBUSY
MOV DATAPORT,A
SETB RS
CLR RW
SETB EN
CLR EN
RET

COMMAND:
ACALL CHKBUSY
MOV DATAPORT,A
CLR RS
CLR RW
SETB EN
CLR EN
RET

LCD216:
MOV A,#38H ;FORCES 2 X 16 MATRIX
ACALL COMMAND
RET

LCDCLR:
MOV A,#01H
ACALL COMMAND
RET

RETHOME:
MOV A,#02H ;RETURN HOME
ACALL COMMAND
RET

DONCOFF:
MOV A,#0CH
ACALL COMMAND
RET

DONCB:
MOV A,#0FH
ACALL COMMAND
RET

FCBFL:
MOV A,#80H
ACALL COMMAND
RET

FCBSL:
MOV A,#0C0H
ACALL COMMAND
RET

WRITE:
CLR A
MOVC A,@A+DPTR
JZ BACK2
ACALL DISPLAY
INC DPTR
JMP WRITE

BACK2: RET



END


sorry for those irritating tabs n identations
 anee like this.
Mon Apr 07 2008, 11:24 pm
#3
waaauuu....., dis is good, no iritating tabs n identations, d windows "notepad" makers need to learn smthng frm here...
 anee like this.
Mon Apr 07 2008, 11:26 pm
#4
hey...thanks...i don think anythin's wrong wid my code..but still...will try usin urs n check...thanks again..n yes...no tabs..:)...i was wonderin at tabs u talkin abt...
Tue Apr 08 2008, 12:27 am
#5
well, either ur code has some problem or ur hardware. so try sending ur circuit and/or ur code and maybe we can find the bug which is bugging u
 anee like this.
Tue Apr 08 2008, 12:39 am
#6
well i saw ur code from the other forum topic. looks fine to me. can u send the circuit so that we can have an idea about how it is wired?.check the following:
1. power supply. preferably connect a 0.1uF decoupling cap across vcc and gnd and as close to microcontroller as possible.
2. connct two 33pF caps across the xtal and gnd.
 anee like this.
Tue Apr 08 2008, 07:53 am
#7
And have you hooked up a proper power-on reset ckt?
Try checking loose connections to the LCD.
 anee like this.
Tue Apr 08 2008, 08:17 am
#8
To add onto what pdi33 said, i suggest u use 0.1uF tantalum caps. They make a world of a change.
Check the supply o/p on the board depending on how well ur board is ul come to know how noisy ur gnd or vcc is. A friend of mine had a terrible time cleaning his ground
I was lucky dint face that problem.

Dont worry ul get amazing advice over here, have faith... I have learnt alot from this forum.

Good luck :bye
 anee like this.
Tue Apr 08 2008, 09:11 am
#9
Oops.....when you can,avoid tantalums like plague.They are prone to leakage and when compared to ceramics are fairly 'slow'.They do have a speed advantage over hefty electrolytics but when choosing between 0.1uF ceramic or tant' always prefer ceramics.Ceramics also have a lower self inductance and are non-polar whereas tants' are essentially polarized(correct me if I'm wrong) and may lead to mishaps when reverse connected.They do have a size advantage over electrolytics though.
Amit..where did you get this info yaar?
 anee like this.
Tue Apr 08 2008, 04:28 pm
#10
thanks all...hey pdi33...my hardware's pretty simple...lcd on p1 n da 3 control signals from p3.0,3.1,3.2...i forgot abt da decoup capa completely...is it dat imp...will add it n try again today...n i m average at solderin,but shashijoseph i checked da continuity on each pin..should i do anythin else...n where can i get good moderately priced dev boards...atleast i won't hav to worry abt da solderin then...
thanks again... :-)

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

StephenHauct
Sat Apr 27 2024, 09:38 am
Adamsaf
Sat Apr 27 2024, 07:12 am
Robertphype
Sat Apr 27 2024, 12:23 am
ktaletrryp
Fri Apr 26 2024, 10:55 pm
Robertrip
Fri Apr 26 2024, 11:20 am
ArnoldDiant
Fri Apr 26 2024, 03:53 am
RodneyKnorb
Thu Apr 25 2024, 07:08 pm
Williamjef
Thu Apr 25 2024, 02:08 pm