0% found this document useful (0 votes)
409 views

Write An ALP To Interface An LCD To 8051 Display A Message

This document contains an assembly language program to interface an LCD display to an 8051 microcontroller to display the message "HELLO". The program initializes the LCD, sends the character codes for each letter of the word to the LCD data register using a DATA_DISPLAY subroutine, and includes delay and ready subroutines. It displays the message by continuously jumping back to the beginning of the HERE label.

Uploaded by

Akash Aman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
409 views

Write An ALP To Interface An LCD To 8051 Display A Message

This document contains an assembly language program to interface an LCD display to an 8051 microcontroller to display the message "HELLO". The program initializes the LCD, sends the character codes for each letter of the word to the LCD data register using a DATA_DISPLAY subroutine, and includes delay and ready subroutines. It displays the message by continuously jumping back to the beginning of the HERE label.

Uploaded by

Akash Aman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

18ECL47 MICROCONTROLLER LABORATORY

1. Write an ALP to interface an LCD to 8051 display a message.

;Assembly language program to interface LCD to display "HELLO" message

MOV P0, #00H; LCD DATA


MOV P1, #00H; LCD CONTROL

; LCD INITIALIZATION

MOV A, #38H ;init LCD 2 lines, 5 x 7 matrix


ACALL COMMAND ; issue command
MOV A, #0CH ; display On, cursor off
ACALL COMMAND ; issue command
MOV A,#01H ;clear display screen
ACALL COMMAND ; issue command
MOV A,#06H ;shift cursor to right
ACALL COMMAND ; issue command
MOV A, #80H ;force cursor to beginning of first line
ACALL COMMAND ; issue command

MOV A, #'H'
ACALL DATA_DISPLAY
ACALL DELAY
MOV A,#'E'
ACALL DELAY
ACALL DATA_DISPLAY
MOV A,#'L'
ACALL DELAY
ACALL DATA_DISPLAY
MOV A,#'L'
ACALL DELAY
ACALL DATA_DISPLAY
MOV A,#'O'
ACALL DELAY
ACALL DATA_DISPLAY
HERE: SJMP HERE

COMMAND: ACALL READY


MOV P0,A
CLR P1.1 ;RS = 0 FOR COMMAND
CLR P1.2 ;R/W =0 TO WRITE TO LCD
SETB P1.3 ;E =1 FOR H TO L PULSE

Department of ECE, CMRIT, Bangalore 2019-20 1


18ECL47 MICROCONTROLLER LABORATORY

CLR P1.3 ;E =0 LATCH IN


RET

DATA_DISPLAY:
ACALL READY
MOV P0,A ; SEND DATA
SETB P1.1 ;RS = 1 FOR DATA
CLR P1.2 ;R/W =0 TO WRITE TO LCD
SETB P1.3 ;E =1 FOR H TO L PULSE
;ACALL DELAY
CLR P1.3 ;E =0 LATCH IN
RET

; LCD ROUTINE

READY: CLR P1.3;


SETB P0.7 ; BUSY BIT MAKE P0.7 INPUT PORT
CLR P1.1 ; RS = 0, ACCESS COMMAND REGISTER
SETB P1.2 ; R/W =1 TO READ COMMAND REGISTER

BACK: CLR P1.3 ;E =0 FOR L TO H PULSE


ACALL DELAY
SETB P1.3 ; E =1 FOR L TO H PULSE
JB P0.7, BACK ; STAY UNTIL BUSY FLAG = 0
RET

DELAY: MOV R6, #255


H1: MOV R7, 255
H2: DJNZ R7, H2
DJNZ R6, H1
RET

END

Demo Link:
https://drive.google.com/drive/folders/1edAiu4_kBYKbpFc2vzb_kFmvUSpav-Le

Department of ECE, CMRIT, Bangalore 2019-20 2

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy