You are on page 1of 4

LCD

INTRODUCTION
The 44780 standard requires 3 control lines as well as either 4 or 8 I/O lines for the data bus. The
user a! select whether the LCD is to o"erate with a 4#bit data bus or an 8#bit data bus. If a 4#bit
data bus is used the LCD will require a total of 7 data lines $3 control lines "lus the 4 lines for the
data bus%. If an 8#bit data bus is used the LCD will require a total of && data lines $3 control lines
"lus the 8 lines for the data bus%.
The three control lines are referred to as EN' RS' and RW.
The EN line is called ()nable.( This control line is used to tell the LCD that !ou are sendin* it data.
To send data to the LCD' !our "ro*ra should a+e sure this line is low $0% and then set the other
two control lines and/or "ut data on the data bus. ,hen the other lines are co"letel! read!' brin*
EN hi*h $&% and wait for the iniu aount of tie required b! the LCD datasheet $this -aries
fro LCD to LCD%' and end b! brin*in* it low $0% a*ain.
The RS line is the (.e*ister /elect( line. ,hen ./ is low $0%' the data is to be treated as a coand
or s"ecial instruction $such as clear screen' "osition cursor' etc.%. ,hen ./ is hi*h $&%' the data bein*
sent is te0t data which sould be dis"la!ed on the screen. 1or e0a"le' to dis"la! the letter (T( on the
screen !ou would set ./ hi*h.
The RW line is the (.ead/,rite( control line. ,hen ., is low $0%' the inforation on the data bus
is bein* written to the LCD. ,hen ., is hi*h $&%' the "ro*ra is effecti-el! quer!in* $or readin*%
the LCD. Onl! one instruction $(2et LCD status(% is a read coand. 3ll others are write
coands##so ., will alost alwa!s be low.
1inall!' the data bus consists of 4 or 8 lines $de"endin* on the ode of o"eration selected b! the
user%. In the case of an 8#bit data bus' the lines are referred to as D40' D4&' D45' D43' D44' D46'
D47' and D47.
PIN DESCRIPTION
Pin Symbol Function
1 Vss Ground
2 Vdd Supply Voltage
3 Vo Contrast Setting
4 RS Register Select
5 R/ Read/rite Select
! "n C#ip "nable Signal
$%14 &'(%&'$ &ata )ines
15 */Vee Vcc +or bac,lig#t
1! - Gnd +or t#e bac,lig#t
LCD COMMANDS
LCD Command Control Codes
Command Binary Hex
D D! D" D# D$ D% D& D'
Clear Dis"la! 0 0 0 0 0 0 0 & 0&
Dis"la! and Cursor
8oe
0 0 0 0 0 0 & 0 05 or
03
Character )ntr!
9ode
0 0 0 0 0 & I/D / 0& to
07
Dis"la! On/Off and
Cursor
0 0 0 0 & D : 4 08 to
01
Dis"la!/Cursor /hift 0 0 0 & D/C ./L 0 0 &0 to
&1
1unction /et 0 0 & 8/4 5/& &0/7 0 0 50 to
31
/et C2.39
3ddress
0 & 3 3 3 3 3 3 40 to
71
/et Dis"la! 3ddress & 3 3 3 3 3 3 3 80 to
11
I/D; &<Increent= 0<Decreent
/; &<Dis"la! /hift
On
0<Dis"la! /hift
off=
D; &<Dis"la! On 0<Dis"la! Off=
:; &<Cursor
:nderline On
0<Cursor
:nderline Off=
4; &<Cursor 4lin+
On
0<Cursor 4lin+
Off=
D/C; &<Dis"la! /hift 0<Cursor 9o-e
./L; &<.i*ht /hift 0<Left /hift
8/4; &<8 bit interface= 0<4 bit interface
5/&; &<5 line ode 0<& line ode=
&0/7; &<60&0 dot forat 0<607 dot
forat=

=<initialisation
settin*
0<don>t care
DISPLA(
DDRAM ) Dis*lay Data RAM
Dis"la! data .39 $DD.39% stores dis"la! data re"resented in 8#bit character codes. Its e0tended
ca"acit! is 80 ? 8 bits' or 80 characters. The area in dis"la! data .39 $DD.39% that is not used
for dis"la! can be used as *eneral data .39. /o whate-er !ou send on the DD.39 is actuall!
dis"la!ed on the LCD. 1or LCDs li+e &0&7' onl! &7 characters are -isible' so whate-er !ou write
after &7 chars is written in DD.39 but is not -isible to the user.
C+ROM ) C,ara-ter +enerator ROM
@ow !ou i*ht be thin+in* that when !ou send an ascii -alue to DD.39' how the character is
dis"la!ed on LCDA so the answer is C2.O9. The character *enerator .O9 *enerates 6 0 8 dot or 6
0 &0 dot character "atterns fro 8#bit character codes. It can *enerate 508 6 0 8 dot character
"atterns and 35 6 0 &0 dot character "atterns. :serdefined character "atterns are also a-ailable b!
as+#"ro*raed .O9.
C+RAM ) C,ara-ter +enerator RAM
3s clear fro the nae' C2.39 area is used to create custo characters in LCD. In the character
*enerator .39' the user can rewrite character "atterns b! "ro*ra. 1or 6 0 8 dots' ei*ht character
"atterns can be written' and for 6 0 &0 dots' four character "atterns can be written.
3ll character based LCD of t!"e 8D44780 has C2.39 area to create user defined "atterns. 1or
a+in* custo "atterns we need to write -alues to the C2.39 area definin* which "i0el to *low.
These -alues are to be written in the C2.39 adress startin* fro 0040. If !ou are wonderin* wh!
it starts fro 0040A Then the answer is *i-en below.
4it 7 is 0 and 4it 7 is &' due to which the C2.39 address coand starts fro 0040' where the
address of C2.39 $3c*% starts fro 0000. C2.39 has a total of 74 4!tes. ,hen !ou are usin*
LCD as 608 dots in function set then !ou can define a total of 8 user defined "atterns $& 4!te for
each row and 8 rows for each "attern%' where as when LCD is wor+in* in 60&0 dots' !ou can define
4 user defined "atterns.
Lets ta+e an of buildin* a custo "attern. 3ll we ha-e to do is a+e a "i0el#a" of 706 and *et the
he0 or decial -alue or he0 -alue for each row' bit -alue is & if "i0el is *lowin* and bit -alue is 0 if
"i0el is off. The final 7 -alues are loaded to the C2.39 one b! one. 3s i said there are 8 rows for
each "attern' so last row is usuall! left blan+ $0000% for the cursor. If !ou are not usin* cursor then
!ou can a+e use of that 8th row also. so !ou *et a bi**er "attern.
Lets make a "Bell" pattern as shown below.
SENDIN+ COMMANDS TO LCD
To send coands we si"l! need to select the coand re*ister. )-er!thin* is sae as we ha-e
done in the initialiBation routine. 4ut we will suariBe the coon ste"s and "ut the in a sin*le
subroutine. 1ollowin* are the ste"s;
9o-e data to LCD "ort
select coand re*ister
select write o"eration
send enable si*nal
wait for LCD to "rocess the coand
SENDIN+ DATA TO LCD
To send data we si"l! need to select the data re*ister. )-er!thin* is sae as the coand routine.
1ollowin* are the ste"s;
9o-e data to LCD "ort
select data re*ister
select write o"eration
send enable si*nal
wait for LCD to "rocess the data

You might also like