You are on page 1of 13

MCA

Practical -2
16 X 2 LCD INTERFACING
Basics of LCD
LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of
applications.
16x2 means 16 columns and 2 rows of alphanumeric ASCII blocks on the LCD
Having three control signals and one databus
Pin Diagram
Coonnections
Pin Description
R/W: When this signal is '1' = Reads data from the LCD RAM. When
this signal is '0' = Writes data on LCD RAM.
EN: Is basically a Latch signal. You have to send '1' first and then '0'
signal with a particular delay to latch the data.
RS: Is a Register Select Control signal. When this signal is '1' = It
accepts data to be displayed. When this signal is '0' = It accepts
instructions for the LCD like setting font, cursor position etc.
D0 to D7: Is 8-bit Databus. It is used to send both data as well as
Instructions to the LCD based upon control signals
Timing DIagram
Command Codes
This are the commands required to initialize the LCD
Functions required for LCD Module
initLCD() : Initializes the LCD.
LCD_Cmd(int) : To issue LCD commands.
LCD_Data(int): Print a Single Character.
LCD_WriteString(string) : Print a String.
delay() :Generate required delay.(For program1 Only!)
Initialization
Initlcd()
Initlcd()
{
lcdcmd(0x38);//Configure the LCD in 8-bit mode,2 line and 5×7 font
lcdcmd(0x0C);// Display On and Cursor Off
lcdcmd(0x01);// Clear display screen
lcdcmd(0x06);// Increment cursor
lcdcmd(0x80);// Set cursor position to 1st line,1st column
}
Sending command to the LC: lcdcmd()
rs=0; Register select pin is low.
rw=0; Read/write Pin is also for writing the command to the LCD.
en=1;enable pin is high.
Sending data to the LCD:
rs=1; Register select pin is high.
rw=0; Read/write Pin is also for writing the command to the LCD.
en=1; enable pin is high.

You might also like