Exp No 3

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

SRI KRISHNA COLLEGE OF TECHNOLOGY

(AN AUTONOMOUS INSTITUTION)

KOVAIPUDUR, COIMBATORE- 641042

Reg. No and Name of the student


Experiment No
Date of Experiment
Title of Experiment

Evaluation by Faculty Member

Maximum Marks Scored


Criteria
Marks by the student
Objectives & Tools required 10
Source Code 30
Compilation and Debugging 30
Result and Discussion 20
Documentation 10
Total Marks

OBJECTIVES
To interface 16x2 LCD display with 8051 microcontroller and to enable it for displaying
different characters.

SYSTEM AND SOFTWARE TOOLS REQUIRED


Keil uVision4 compiler, 8051 Microcontroller Development board, 16x2 LCD

THEORY
Keil C does not have powerful libraries for 16x2 LCD interfacing. Hence LCD library must be
developed with common features. Header file lcd.h must include the sub-program for LCD functions.
LCD can be interfaced with microcontroller in 4 Bit or 8 Bit mode. This differs in how data is send to
LCD. In 8 bit mode to write a character, 8 bit ASCII data is send through the data lines D0 – D7 and data
strobe is given through E of the LCD. But 4 Bit Mode uses only 4 data lines D4 – D7. In this mode 8 bit
character ASCII data and command data are divided into two parts and send sequentially through data
lines. 4 bit communication is used save pins of microcontroller but it is slower than 8 bit communication.
ALGORITHMS

Step1: Include a header file to assign special function registers for ports of the microcontroller
Step2: Include a header file for LCD i.e. lcd.h
Step3: Assign LCD module connections to ports of the controller. Example: sbit RS = P0^0;
Step4: Use sub-routines for invoking delay
Step5: Use special functions of LCD in main program
Step6: For 4 bit LCD interface, use LCD4 instead of LCD8 functions

FUNCTIONS USED FOR INTERFACING LCD:

Sub-routines for accessing LCD can be designed in header files

Functions Description
Lcd8_Clear() Clear the LCD screen
Lcd8_Set_Cursor() To set the cursor position on the LCD screen
Lcd8_Write_Char() To write a character
Lcd8_Write_String() To write a string
Lcd8_Shift_Left() Shift display left without changing the data in display RAM
Lcd8_Shift_Right() Shift display right without changing the data in display

INTERFACING DIAGRAM:
PROGRAM:
RESULT
Thus the 16x2 LCD display is interfaced with 8051 microcontroller and different
characters was displayed and verified

You might also like