0% found this document useful (0 votes)
13 views13 pages

MPMC Lab Task 5 - Merged

The document outlines a lab task for displaying a name and registration number on a 16x2 LCD using an 8051 microcontroller. It includes an assembly program with detailed instructions and subroutines for writing commands and data to the LCD, as well as a pin diagram. The aim is to develop the program and understand its functionality through practical implementation.

Uploaded by

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

MPMC Lab Task 5 - Merged

The document outlines a lab task for displaying a name and registration number on a 16x2 LCD using an 8051 microcontroller. It includes an assembly program with detailed instructions and subroutines for writing commands and data to the LCD, as well as a pin diagram. The aim is to develop the program and understand its functionality through practical implementation.

Uploaded by

Dhruv Asodaria
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Winter Semester 2024-2025

BECE204P Microprocessors and Microcontrollers Lab

NAME: Siddhant Sinha


REG NO: 23BEC0307
SLOT: L13+14
Faculty – DR. GOPINATH P

LAB TASK 5
1. Write an assembly program to display your Name
(Just first name in the first line) using a 16x2 LCD
interfaced with 8051 microcontrollers. Display your
registration number in the second line of LCD. Include
explanation for the program with relevant pin diagram.
AIM: To develop an assembly program to display the
first name (on first line) and registration number (on
second line) on a 16x2 LCD interfaced with the 8051
microcontrollers, explain with relevant pin diagram.
TOOLS USED: Keil uVision5 Software, Flash Magic and
8051 Microcontroller, 16X2 LCD (Liquid Crystal Display)
PROGRAM:
;23BEC0307
ORG 0H ; Start of the program memory
MOV A,#38H ; LCD 8-bit 2-line mode
ACALL CMDWRT ; Call command write
subroutine
ACALL DELAY ; Call delay for LCD

MOV A,#0EH ; Display ON, cursor ON


ACALL CMDWRT
ACALL DELAY

MOV A,#01H ; Clear LCD display screen


ACALL CMDWRT
ACALL DELAY

MOV A,#06H ; Increment cursor position


setting
ACALL CMDWRT
ACALL DELAY

MOV A,#084H ; Set LCD cursor position


ACALL CMDWRT
ACALL DELAY

MOV A,#'S' ; Load character 'S' in A and display


ACALL DATAWRT ; Call data write subroutine
ACALL DELAY

MOV A,#'I'
ACALL DATAWRT
ACALL DELAY
MOV A,#'D'
ACALL DATAWRT
ACALL DELAY

MOV A,#'D'
ACALL DATAWRT
ACALL DELAY

MOV A,#'H'
ACALL DATAWRT
ACALL DELAY

MOV A,#'A'
ACALL DATAWRT
ACALL DELAY

MOV A,#'N'
ACALL DATAWRT
ACALL DELAY
MOV A,#'T'
ACALL DATAWRT
ACALL DELAY

MOV A,#0C4H ; Set second line cursor


ACALL CMDWRT
ACALL DELAY

MOV A,#'2'
ACALL DATAWRT
ACALL DELAY

MOV A,#'3'
ACALL DATAWRT
ACALL DELAY

MOV A,#'B'
ACALL DATAWRT
ACALL DELAY
MOV A,#'E'
ACALL DATAWRT
ACALL DELAY

MOV A,#'C'
ACALL DATAWRT
ACALL DELAY

MOV A,#'0'
ACALL DATAWRT
ACALL DELAY

MOV A,#'3'
ACALL DATAWRT
ACALL DELAY

MOV A,#'0'
ACALL DATAWRT
ACALL DELAY
MOV A,#'7'
ACALL DATAWRT
ACALL DELAY

AGAIN: SJMP AGAIN ; Stay here in infinite loop

CMDWRT:
MOV P1,A ; Move data/command to port 1
CLR P2.0 ; RS = 0 for command
CLR P2.1 ; RW = 0 for write
SETB P2.2 ; Enable pin high
ACALL DELAY
CLR P2.2 ; Enable pin low
RET ; Return from subroutine

DATAWRT:
MOV P1,A ; Move character to port 1
SETB P2.0 ; RS = 1 for data
CLR P2.1 ; RW = 0 for write
SETB P2.2 ; Enable pin high
ACALL DELAY
CLR P2.2
RET

DELAY:
MOV R3,#255 ; Load outer loop counter
HERE2: MOV R4,#255 ; Load inner loop counter
HERE: DJNZ R4,HERE ; Decrement R4 and loop
DJNZ R3,HERE2 ; Decrement R3 and loop
RET
END
PIN DIAGRAM:
RESULTS:

You might also like