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.

SCROLLING TEXT ON 2x16 LCD USING 8051

Status
Not open for further replies.

Mehmood Ahmed

New Member
There may be much room for improvement of this code but i am not very much concerned with it...my main concern is the i want it improved in this regard that it should keep on scrolling the text of any lenght without breaks whereas below given code does not do it for me...
thanx in advance.



;----------------------------------------------------------------------
;----------------------------------------------------------------------
DB0 EQU P1.0
DB1 EQU P1.1
DB2 EQU P1.2
DB3 EQU P1.3
DB4 EQU P1.4
DB5 EQU P1.5
DB6 EQU P1.6
DB7 EQU P1.7
RS EQU P3.3
RW EQU P3.4
EN EQU P3.5

ORG 300H
DB "THIS CODE IS WRITTEN BY MEHMOOD AHMED FOR 8051"
DB "MICROCONTROLLER",0

ORG 00H
START:
ACALL INITLCD
MOV A,#0H
MOV DPTR,#0300H
MAIN:
ACALL COMMANDDELAY
CLR EN
PUSH ACC
CJNE A,#170,ISLESS
CALL SCROLLDELAY
MOV A,#0H
ISLESS:
JZ HERE
MOV B,#40
DIV AB
MOV A,B
JNZ HERE
MOV A,#02H
ACALL COMMAND
HERE:
POP ACC
PUSH ACC
MOVC A,@A+DPTR
ACALL WRITECOMMAND
POP ACC
INC A
LJMP MAIN
COMMAND:
CLR RS
CLR RW
MOV P1,A
SETB EN
ACALL COMMANDDELAY
CLR EN
RET
WRITECOMMAND:
ACALL SCROLLDELAY
ACALL SCROLLDELAY
SETB RS
CLR RW
MOV P1,A
SETB EN
ACALL COMMANDDELAY
CLR EN
RET
INITLCD:
MOV A,#30H
ACALL COMMAND
MOV A,#30H
ACALL COMMAND
MOV A,#30H
ACALL COMMAND
MOV A,#07H
ACALL COMMAND
MOV A,#0cH
ACALL COMMAND
;MOV A,#010h
;ACALL COMMAND
RET
COMMANDDELAY:
MOV R1,#20H
LOOP2: MOV R0,#20H
LOOP1: DJNZ R0,LOOP1
DJNZ R1,LOOP2
RET
SCROLLDELAY:
MOV R3,#2H
LOOPX3:
MOV R2,#90H
LOOPX2: MOV R1,#90H
LOOPX1: DJNZ R1,LOOPX1
DJNZ R2,LOOPX2
DJNZ R3,LOOPX3
RET
LCDWAIT:
PUSH ACC
CLR A
WAIT:
CLR RS
SETB WR
SETB EN
MOV P1,#0FFH
MOV A,P1
CLR EN
JB ACC.7,WAIT
POP ACC
RET
END
 
Status
Not open for further replies.

Latest threads

Back
Top