Continue to Site

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.

  • 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.

Driving LCD 4*20 with 89C55

Status
Not open for further replies.

Hesam Kamalan

New Member
hi all,
i wrote a program for driving 4*20 LCD. after executing of program, i can see line1 and line2 on LCD display, but i can not see line2, line4. please guide me how can i display all four lines.
 
Last edited:
;My Project
;**********************************************

LCD_OUT EQU P2
RS EQU P1.0
RW EQU P0.0
E EQU P1.1
FINE EQU 40
;**********************************************

ORG 0H
MOV FINE,#20
SJMP BODY

ORG 30H
BODY:
LCALL INIT
LOOP: MOV A,#80H ; 1'st Line Display
LCALL COMMAND

MOV DPTR,#TABLE1
MOV R0,FINE
AGAIN: CLR A
MOVC A,@A+DPTR
LCALL ASCII
INC DPTR
DJNZ R0,AGAIN

MOV A,#0C0H ; 2'ed Line Display
LCALL COMMAND

MOV DPTR,#TABLE2
MOV R0,FINE
AGAIN1: CLR A
MOVC A,@A+DPTR
LCALL ASCII
INC DPTR
DJNZ R0,AGAIN1

MOV A,#94H ; 3'rd Line Display
LCALL COMMAND
MOV DPTR,#TABLE3
MOV R0,FINE
AGAIN2: CLR A
MOVC A,@A+DPTR
LCALL ASCII
INC DPTR
DJNZ R0,AGAIN2

MOV A,#0D4H ; 4'th Line Display
LCALL COMMAND

MOV DPTR,#TABLE4
MOV R0,FINE
AGAIN3: CLR A
MOVC A,@A+DPTR
LCALL ASCII
INC DPTR
DJNZ R0,AGAIN3
SJMP LOOP
;**********************************************
INIT:
MOV A,#01H ; Clear Display
LCALL COMMAND

MOV A,#02H ; Return Home
LCALL COMMAND

MOV A,#06H ; Move Direction and Specifies shift of Display, Increment
LCALL COMMAND

MOV A,#0CH ; Display on / Curser Off, Blinking Off
LCALL COMMAND

MOV A,#1CH ; Cursor or Display Shift, 8 bit, Two line
LCALL COMMAND

MOV A,#30H ;Function Set/2 Lines and 5*7 Matrix
LCALL COMMAND

RET
;***************
COMMAND: MOV LCD_OUT,A
CLR RS
CLR RW
SETB E
NOP
CLR E
LCALL DELAY
RET

DELAY: MOV R7,#250
HERE: MOV R6,#255
DJNZ R6,$
DJNZ R7,HERE
RET

ASCII: MOV LCD_OUT,A
SETB RS
CLR RW
SETB E
NOP
CLR E
LCALL DELAY
RET


;|||||||||||||||||||||||||||||||||||||||

TABLE1: DB " *** Line 1 ****---" ;80
TABLE2: DB " *** Line 2 ****---" ;C0
TABLE3: DB " *** Line 3 ****---" ;94
TABLE4: DB " *** Line 4 ****---" ;D4

END
 
THX,
i found it. problem is on : "MOV A,#30H ;Function Set/2 Lines and 5*7 Matrix" line that i change it to "MOV A,#30H ;".
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top