100% found this document useful (1 vote)
333 views11 pages

Interfacing 16×2 LCD With 8051

This document discusses interfacing a 16x2 LCD module to an 8051 microcontroller. It begins by providing a brief overview of 16x2 LCDs and their pin configurations. It then describes the steps to display characters on an LCD, including initializing the LCD by sending commands, setting the enable, register select, and read/write pins, and writing data. The document outlines the components needed for the interfacing circuit and provides an explanation of the circuit. It concludes by listing the steps for programming the LCD interfacing in C language, including initializing the LCD, sending commands, and writing data.

Uploaded by

Malia Mendez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
333 views11 pages

Interfacing 16×2 LCD With 8051

This document discusses interfacing a 16x2 LCD module to an 8051 microcontroller. It begins by providing a brief overview of 16x2 LCDs and their pin configurations. It then describes the steps to display characters on an LCD, including initializing the LCD by sending commands, setting the enable, register select, and read/write pins, and writing data. The document outlines the components needed for the interfacing circuit and provides an explanation of the circuit. It concludes by listing the steps for programming the LCD interfacing in C language, including initializing the LCD, sending commands, and writing data.

Uploaded by

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

INTERFACING LCD WITH 8051

In this practical, we will have brief discussion on how to interface


16×2(5x)7 LCD module to AT89C51, which is an 8051 family
microcontroller. We use LCD display for the displaying messages
in a more interactive way to operate the system or displaying error
messages etc. Interfacing 16×2 LCD with 8051 microcontroller is

Valmik Dhanwate
very easy if you understanding the working of LCD.

Hence, in this practical, I will not only give the information of


LCD and also provide the code in C language which is working
fine without
1 any errors.
A BRIEF NOTE ON 16×2 LCD
 16×2 Liquid Crystal Display which will display the 32
characters at a time in two rows (16 characters in one row).
Each character in the display is of size 5×7 pixel matrix. This
matrix differs for different 16×2 LCD modules, if you take
JHD162A, this matrix goes to 5×8. There are 16 pins in the

Valmik Dhanwate
LCD module, the pin configuration us given below.

2
THE PIN CONFIGURATION
 There are 16 pins in the LCD module

Valmik Dhanwate
3
STEPS :-
 Follow these simple steps for displaying a character or data
 E=1; enable pin should be high

 RS=1; Register select should be high

Valmik Dhanwate
 R/W=0; Read/Write pin should be low.

 To send a command to the LCD just follows these steps:


 E=1; enable pin should be high

 RS=0; Register select should be low

 R/W=0; Read/Write pin should be low.

4
LCD COMMANDS :-
There are some preset commands which will do a specific task in the LCD.
These commands are very important for displaying data in LCD. The list of
commands given below:

Valmik Dhanwate
5
INTERFACING 16×2 LCD WITH 8051 CIRCUIT
DIAGRAM

Valmik Dhanwate
6
COMPONENTS REQUIRED 
 AT89C51 (8051 Microcontroller)
 16X2 LCD Display
 11.0592MHz Crystal
 2 X 33pF Capacitors 

Valmik Dhanwate
 2 X 10 KΩ Resistors
 1 KΩ X 8 Resistor Pack 
 10 KΩ Potentiometer 
 330Ω Resistor 
 Push Button 
 10μF/16V Capacitor 
 8051 Programmer 
 5V Power Supply 
 Connecting Wires 7
CIRCUIT EXPLANATION
 The crystal oscillator, along with two 33pF Capacitors, are
connected to XTAL1 and XTAL2, which will provide the
system clock to the microcontroller. 
 RST Pin is pulled-LOW with the help of a 10KΩ Resistor.

Valmik Dhanwate
With the help of a 10μF Capacitor and a Push Button, you can
reset the 8051 Microcontroller. EA is pulled-HIGH with the
help of a 10KΩ resistor. 
 The data pins of the LCD are connected to PORT0 (first, the
PORT0 pins must be pulled-HIGH with the help of a 1KΩ
Resistor Pack). RS and E are connected to PORT2 pins P2.0
and P2.1.
 A 10KΩ Potentiometer is used to adjust the contrast of the
LCD. 
8
PROGRAMMING LCD TO 8051 :-
 Coming to the programming you should follow these steps:
 STEP1: Initialization of LCD.

 STEP2: Sending commands to LCD.

 STEP3: Writing the data to LCD.

Valmik Dhanwate
 Initializing LCD :-
 To initialize LCD to the 8051 the following instruction and
commands are to be embed in to the functions
 0x38 is used for 8-bit data initialization.

 0xoC for making LCD display on and cursor off.

 0X01 for clearing the display of the LCD.

 0x80 for positioning the cursor at first line .


9
(0x83 for positioning the cursor at first line & third character) .
SENDING COMMANDS TO THE LCD :-
 E=1; enable pin should be high
 RS=0; Register select should be low for sending commands

 Placing the data on the data registers

 R/W=0; Read/Write pin should be low for writing the data.

Valmik Dhanwate
WRITING THE DATA TO THE LCD
 E=1; enable pin should be high

 RS=1; Register select should be high for writing data

 Placing the data on the data registers

 R/W=0; Read/Write pin should be low for writing the data.

10
CODE 
 #include<reg51.h>
 #define lcd P2

 sbit rs=P2^0;

 sbit e=P2^1;

Valmik Dhanwate
11

You might also like