Download as TXT, PDF, TXT or read online from Scribd
Download as txt, pdf, or txt
You are on page 1of 2
; LCD
ORG 00H ; CODE FOR SENDING COMMANDS TO LCD FOR INTIALIZING AGAIN:
MOV A, #38H ; 2 LINES AND 5x7 MATRIX
ACALL COMMAND ACALL DELAY MOV A, #0EH ; DISPLAY ON CURSOR BLINKING ACALL COMMAND ACALL DELAY MOV A, #01H ; CLEAR DISPLAY SCREEN ACALL COMMAND ACALL DELAY MOV A, #06H ; SHIFT CURSOR TO THE RIGHT (INCREMENT CURSOR) ACALL COMMAND ACALL DELAY
MOV A, #80H ; MOVE CURSOR TO FIRST ROW FIRST CHARACTER
ACALL COMMAND ACALL DELAY ; CODE FOR SENDING CHARACTERS - NAME IN FIRST ROW OF LOCD MOV DPTR, #CODES1 BACK: CLR A MOVC A, @A+DPTR CJNE A, #47, CONTINUE JMP ROLLNO CONTINUE: ACALL CHARAC ACALL DELAY INC DPTR JMP BACK
; CODE FOR SENDING CHARACTERS - ROLL NUMBER IN SECOND ROW OF LOCD
ROLLNO: MOV A, #0C0H ; MOVE CURSOR TO SECOND ROW FIRST CHARACTER
ACALL COMMAND ACALL DELAY MOV DPTR, #CODES2 BACK1: CLR A MOVC A, @A+DPTR CJNE A, #47, CONTINUE1 SJMP AGAIN CONTINUE1: ACALL CHARAC ACALL DELAY INC DPTR JMP BACK1
; FUNCTION FOR SENDING COMMAND TO LCD
COMMAND: MOV P1, A CLR P2.0 ;rs =0 FOR COMMAND REGISTER CLR P2.1 ;r/w=0 FOR WRITE OPERATION SETB P2.2 ;e=1 (HIGH)INITIIALLY ACALL DELAY CLR P2.2 ;E=0 RET ;FUNCTION FOR SENDING CHARACTER TO LCD CHARAC: MOV P1, A SETB P2.0 ; ;rs =1 FOR DATA REGISTER CLR P2.1 ;r/w=0 FOR WRITE OPERATION SETB P2.2 ;e=1 (HIGH) INITIIALLY ACALL DELAY CLR P2.2 ; e =0 (LOW) RET
;DELAY FUNCTION DELAY: MOV R3, #05d HERE2: MOV R4, #02d HERE: DJNZ R4, HERE DJNZ R3, HERE2 RET