• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

data not displaying in second line of 16X2 LCD ; JHD 162A

Status
Not open for further replies.
hi;
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 it just displayd first line with second line blank :-(

i am using 89c52 microcontroller and JHD 162A LCD 16x2 display. i am using assembly to program it. Following is my code:

;..................program for LCD Display............................................................................................................
RS BIT P2.0
RW BIT P2.1
E BIT P2.2

ORG 00H

MAIN: MOV DPTR, #MYCOM

C1: CLR A
MOVC A,@A+DPTR
ACALL COMNWRT ; call command subroutien
ACALL DELAY ; GIVE LCD some time to process
INC DPTR
JZ SEND_DATA
SJMP C1

SEND_DATA: MOV DPTR,#MYDATA_1
D1: CLR A
MOVC A,@A+DPTR
ACALL DATAWRT ; Call data subroutien
ACALL DELAY
INC DPTR
JZ NEXT
SJMP D1


NEXT: MOV A,#06H ; i think problem is in this routine
CALL COMNWRT
CALL DELAY

MOV A,#0C2H
CALL COMNWRT
CALL DELAY


MOV A,#10011001B ;4,,,12V
CALL FORM_DATA


MOV A,#0C9H
CALL COMNWRT
CALL DELAY

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


SJMP $


FORM_DATA: ; im skiping mathamatical manipulations here for simplicity.

DISPLAY: ADD A,#48 ; Convert data to ASCII codes and sent to lcd for display
MOV P0,A
CALL DATAWRT
CALL DELAY
RET


COMNWRT: MOV P0,A ;Send command to lcd
CLR RS ; RS=0 for command register
CLR RW ; R/W=0 for write
SETB E ; E=1 for high pulse
ACALL DELAY
CLR E ;E=0 FOR low pulse

RET


DATAWRT: MOV P0,A ;Copy data to port 1
SETB RS ; RS=1 For data register
CLR RW
SETB E
ACALL DELAY
CLR E
RET


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


MYDATA_1: DB "VOLTS(V) AMPS(A)"


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

RET

i will be very thankfull to you for your help.

Regards
Qaisar Azeemi
 
Hi, I didn't get time to go through your code.
I have various assembly code on my website.
Visit this:
http://www.projectsof8051.com/downloads/download-assembly-codes.html

your website is really good and helpful....... i appreciate your work here.

i go throug your code and have questions in my mind that i wana ask,

following is a part of your code:

lcddisp mov lcddatabus,#01h
call lcdcmd
mov 39h,#00h
lcddisp2 mov a,39h
movc a,@a+dptr
cjne a,#'@',lcddisp1
mov lcddatabus,#c0h
call lcdcmd
inc 39h
jmp lcddisp2
lcddisp1 cjne a,#'$',lcddisp3
call pc_int
ret
lcddisp3 mov lcddatabus,a
call lcddata
inc 39h
jmp lcddisp2




1) from your above code it is possible to use the command c0h after we have used 80h in LCD initialization. so with this respect my code is right here. plz do check my code for possible mistake..

i have also remove the command 06h in bold part (Possibly problematic part) of my code. i used that command before 0c2h in my code.


2) in your above written code you have used the memory location 39h and you are incrementing its contants to move data pointer to next location. can we not simply clear A and directly increment DPTR and make it to move to next location??? what is the technical difference between the two.

hope you will answer me.

thanks and regards
Qaisar Azeemi
 

haider007

New Member
i havn't gone through whole codebut if you make 80h in command which means start display on first line of lcd but if you make it CO means start from 2nd line directly
you can also solve problem by using this method first line start from 00 to 63 hence your lcd is only 16 character wide means from 00 to 15 remaing 15 to 63 can't be shown on first line and 2nd line starts from 64 and on ward .volts(V) Amps() should be on first line count chracters with spaces this is 15 character use space to complete 63 character automatically
9.0 3.0 will be dispalyed on next line



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


MYDATA_1: DB "VOLTS(V) AMPS(A)--------------------------------------------------------------------",'9.0 3.0' ;count charatcer with spaces and make it 63
 
Last edited:

ntelectronics

New Member
اسلام علیکم
Dear Qaiser Azeemi,
I have also same problem with my program ,
I send ''38h" at the time of initialization three or four times my problem solved.
Please try your problem must be solved by this..
 

geobabu

Member
Hi,
In practical cases the LCD required to initialize with the command 0x38 for 3 times.
then 0x0E; cmd 0x01; cmd 0x06

Visible Address range 1st line 0x80 ..... 0x8F
2nd line 0xC0 ......0xCF
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading

 
Top