Sie sind auf Seite 1von 21

Chapter 7: Intelligent LCD Display

LCD displays are widely used in many applications like mobile phones,
robotics, DVD players, Measurement instruments etc. Intelligent LCD
displays complete ASCII character set and een graphics. !hese are
easily connected with micro controllers and microprocessors. LCD
displays are complete embedded system in them, because it include micro
controller, "AM and "#M.
!he intelligent displays are o$ two types
a% !e&t Display
b% 'raphics Display
!e&t display can display all character set. And graphics display can show
any graphics display can show any graphics because they are inter$aced
pi&el wise.
In recent your the LCD is $inding widespread use replacing L(Ds )seen
segment L(Ds or other multi segment L(Ds%. !his is due to the
$ollowing reasons*
a. !he declining prices o$ LCDs
b. !he ability to display the numbers, characters and graphics. !his
not possible in L(Ds, which can display numbers and $ew
characters.
c. Incorporation o$ a re$reshing controller into LCD, !hereby
relieing the C+, o$ the task o$ re$reshing the LCD. In contract the
L(D must be re$reshed by the C+, )or in same other way% to keep
displaying the data.
!he inter$acing o$ LCD is -uite di$$icult. .ut we will try to make it
simple and let us e&plain it $or you.
/e will learn how to inter$ace the te&t intelligent LCD display. !hese
displays are aailable in the market o$ 01 column and one "ow and more
than one "ow displays.
2ere is the block diagram o$ a LCD display.
Micro controller* it is the brain o$ LCD display. !his is handling the all
working o$ the LCD.
Data "AM* !his "AM is storing the ASCII alues o$ corresponding
characters will be displayed on the LCD. 3or each column there is one
location in the "AM. /hen we will store the ASCII alue at that location
than it4s corresponding character will be displayed on the screen.
Code "AM* !his store the binary pattern according to the Character.
"#M* !his "AM store the binary pattern which is according to the +i&els
o$ LCD. !he ASCII alues o$ Characters will be gien to the data
register.
.3 ).usy 3lag%* It indicate the internal working o$ the LCD. It show
whether LCD is busy in any operation or not.
I$ .3 56 )LCD is idle we can proceed $or ne&t operation%
I$ .350 )LCD is busy we can4t proceed $or ne&t operation and we hae to
wait unless operation completes%.
Description o$ +I7s is gien below.
Vcc, Vss and Vee
/hile Vcc and Vss proide 89V and ground, respectiely, Vee is used
$or controlling LCD contract.
:"S )"egister Select%*
!he "S pin is used to select D" or C".
I$ "S5C" register is selected, allowing the user to send a command such
as clear display, curser at home etc. I$ "S50, D" resister is selected,
allowing the user to data be display on the LCD.
";/ )"ead;/rite%*
/hen ";/ 56, "ead operation.
(7 )(nable%*
!he enable pin is used by the LCD to latch binary bits aailable on its
data pins. /hen data is supplied to data pins, a negatie edge is applied
to this pin so that the LCD latches in the data present at the data pins.
!his pulse must be a minimum o$ <96 ns wide.
!here should be positie edge at (7 pin when read operation is re-uired.

D= >D6*
!his is ?@bit pins. D=@D6 are used to send in$ormation to the LCD or read
the contents o$ the LCDAs internal registers.
.B@L(D*
!hese pins are used to gie the supply to the backlight o$ the LCD
display. So, that content o$ the LCD display can be iewed in the dark.
+in Diagram is shown below
0 C D < 9 1 = ? E 06 00 0C 0D 0< 09
01
'7D Vcc C "S ";/ (7 D6 D0 DC DD D< D9 D1 D9
L(D8L(D@
!he List o$ Commands is shown in the*
Action "s "/ D= D1 D9 D< DD DC D0 D6
Description
Clear 6 6 6 6 6 6 6 6 6 6 0 Clear complete display, sets "AM
address counter at 6
"eturn 6 6 6 6 6 6 6 6 0 F 2ome cursor, shi$t string to the
original position, but do not cler "AM contents.
(ntry mode set 6 6 6 6 6 6 6 0 0;D S Sets cursor
moe direction and speci$ies shi$t o$ display. !hese operation are
per$ormed during data write and read
S56, cursor S 50, screen I;D 50 increment )right shi$t% I;D 56, decrement
)le$t shi$t%
Display on ;o$$ control 6 6 6 6 6 6 0 D C . Set
on ;o$$ o$ entire display )D% , cursor on;o$$ G, and blink o$ cursor position
character ).% D50, Display #7 56 , Display #33 C50, Cursor #7
56, Cursor #33 .50, .linking #7 56 .linking #33

Cursor or Display Shi$t 6 6 6 6 6 0 S;C ";L @
@ Moes cursor and shi$t display without changing DD "AM contents
3unction set 6 6 6 6 0 DL 7 3 @ @ Sets
inter$ace data length )DL% number o$ display lines )L% and character $rom
)3% DL 50,? buts;Char DL@6, < bits ;Char 750,C line display 756, 0 line
display 3550 .ig 3ont )06H9% 356, Small $ont )=H9%
Set C' "AM Address 6 6 6 0 A'C Sets Code "AM
address
Set DD "AM 6 6 0 A1 A9 A< AD AC A0
A6 Sets Data "AM address.
"ead .usy 3lag I Address 6 0 .3 A1 A9 A< AD AC
A0 A6 "eads busy $lag ).3% indicating internal operation is being
per$ormed and read address counter content.
+rogramme*
7o6 (J, 6C#2
7#0 (J, 63E2
K
7#E (J, E62
L Main +rogramme
#"' 6
L##+* M#V +07o6
ACALL D(LAM#7(
M#V p0,7#0
ACALL D(LAM#7(
SNM+ L##+
D(LAM#7((*
M#V "6,O6(2
L##+"*
M#V A ,O6332
L##+.*
7#+
7#+
M#V .,O6332
L##+A*
DN7P ., L##+A
DN7P "6 6(62, L##+.
DN7P "6, L##+"
"(!
(7D
(&periment 9* Inter$acing o$ ? keys and =@Segment L(D Display with
microcontroller ?690
#bQectie*
In this e&periment we will learn how to use more then one key and how
to identi$y each key stroke. 2ere according to pressed key corresponding
no will be displayed on the L(D display connected with microcontroller.
Circuit*
!he circuit is shown in the $igure. 2ere we are inter$acing the = segment
L(D display with +ort 0. !he Let Display is gien Vcc $orm pin no D and
?, which are anode pins. 3or keys we are using push button keys which
are connected with port C. 2ere we are using resistors o$ CC6 with each
key. /hen user will press any key then that particular pin become L#/
and we will identi$y it. I$ not writing the so$tware in such a way that until
any key is pressed because o$ preious action control will not moe
ahead. And when it is con$irm that all keys are open then scanning o$
keys will starts.
!he content o$ the +C is copied to the accumulator, a$ter that each bits o$
the accumulator is checked in a se-uence starting $orm bit 6 to bit=. !he
$low chart indicate this thing.

+rogramme*
!he programme is gien belowL in this coding we are e-uating the +attern
$or nos 6 to E as gien in the preious e&periment.
Coding*
L Coding $or ? Beys Dip Switch Led Display Inter$acing
7#6 (J, 6CE2
7#= (J, 63?2
B(M (J, +C
DA!A (J, +0
B(M6 (J, +C.6
B(M0 (J, +C.0
B(MC (J, +C.C
B(MD (J, +C.D
B(M< (J, +C.<
B(M9 (J, +C.9
B(M1 (J, +C.1
B(M= (J, +C.=
B(M? (J, +C.?
B(ME (J, +C.E
#"' 66662
M#V B(M,O6332 Lcon$iguring input
M#V DA!A,O6332 Lde$ault display
L##+*
M#V A, B(M "ead keys
CN7( A , O6332,L##+
L/AI! ,7!ILL ,S(" D# 7#! +"(SS !2( B(M
/AI!.
M#V A, B(M
CN7( A, O6332, 7(F!
SNM+ /AI!
7(F!
ACALL D(LAMC6M
M#V A, B(M
CN7( A, O6332.7(F!0
SNM+ /AI!
7(F!0*
N. ACC.6 SB(M0
M#V DA!A,O7o6
ANM+ L##+
SB(M0*
N. ACC.0, SB(MC
M#V DA!A, O7#0
ANM+ L##+
SB(MC*
N. ACC.C,SB(MD
M#V DA!A,O7#C
ANM+ L##+
SB(MSDL
N. ACC.D, SB0LM<
M#V DA!A, O7#D
ANM+ L##+
SB(M<L
N. ACC,<, SB(MS
M#V DA!A,O7#<
ANM+ L##+
So, there are $ollowing combinations o$ certain $unctions
Command Code )2(F% Description
602 Clear display screen
6C2 "eturn home
6<2 Decrement cursor )shi$t cursor to le$t%
612 Increment cursor )shi$t cursor to le$t%
692 Shi$t display right
6=2 Shi$t display le$t
6?2 Display o$$, cursor o$$
6A2 Display o$$, cursor on
6C2 Display on, cursor o$$
6(2 Display on, cursor not blinking
632 Display on, cursor blinking
062 Shi$t cursor position to le$t
0<2 Shi$t cursor position to right
0?2 Shi$t the entire display to the le$t
IC2 Shi$t the entire display to the right
?62 3orce cursor to beginning o$ 0
st
line
C62 3orce cursor to beginning o$ C
nd
line
D?2 C lines and 9H= matri&

Inter$acing o$ LCD can be easily inter$aced with the MC. 3or that we
connect port lines this e&ample "S o$ LCD is "/ o$ LCD is connected
with +D.D (7 o$ LCD is connected with +D.< Data line o$ LCD is
connected with +0 o$ MC.
In the e&periment o$ LCD we will show you how to display any character
on the LCD. /e are using C line LCD display.
!he detail o$ e&periment is shown on the ne&t page.
(&periment Inter$acing o$ Intelligent LCD Display with microcontroller
?690
#bQectie*
In this e&periment we will learn how to use LCD display and how to
write Command and Display routines to send command .yte and
Character byte on the LCD. /e will display R2ello /orld Ron the LCD.
Circuit*
!he idea is $or shown is that preious chapter.
3low Chart*
!he idea is $or program is that $irst we hae to do settings o$ the LCD and
then we will send each character on the LCD.
Start
LCD Setting* 7o o$ Lines, Data Length and 3ont SiSe
LCD Setting* Display #n, Cursor #n;#$$ and .linking #n. #$$
LCD Setting* Cursor Moement Setting
LCD Setting* Clear LCD
Send starting Address
Send Characters
(nd
Command
DA!AT5 Command .te
"S T56
"/ T56
(7 T5@Aie (dge
Check .usy 3lag
.3
56
return

Data
Command
DA!AT5 Command .te
"S T50
"/ T56
(7 T5@Aie (dge
Check .usy 3lag
.3 50
56
return

#rg 6666h
lcdisp*
mo a, OD?h
Lmo a, OD6h
acall command
mo a,O6eh
acall a, O61h
acall command
mo a, O60h
acall command
mo a, O?6h
acall command
mo a,O/
acall display
mo a, O4e4
acall display
mo a,O404
acall display
mo a,O4c4
acall display
mo a, O4o4
acall display
mo a, O4m4
mo a, O4e4
acall display
Lmo a, O6c6h
mo a, O??h
acall command
mo a,O4!4
acall display
mo a, O4o4
acall display
acall o$
L 7e&t Line
mo a ,OD?h
acall command
mo a, O6eh
acall command
mo a,O60h
acall command
mo a,O6c6h
acall command
mo a,O61h
acall command
mo a,O4C4
acall display
acall o$$
mo a,O4(4
acall display
acall o$$
mo a, !
acall o$$
mo a,O4+4
acall display
acall o$$
mo a,OA4
acall display
acall o$$
Lmo a,O?1h
Lmo a, O6c1h
L acall command
mo a,O44
acall display
acall o$$
mo a,O4S4
acall display
acall o$$
mo a4OM4
acall display
acall o$$
mo a, O4S4
acall display
acall o$$
mo a,O!
acall display
acall o$$
mo a, O(
acall display
acall o$$
mo a,OM
acall display
acall o$$
mo a, OUSU
acall display
acall o$$
here* sQmp here
LHHHHHHHHHHHHHHHHHHHHHHHH
Delay subroutine
o$$L
mo b, O6$$h
loopb*
mo a, O6$$h
loopa*
dec a
nop
nop
nop
nop
nop
nop
QnS loopa
dQnS 6$6h, loopb
ret
LLCD strobe subroutines
command*
acall ready
mo pl,a
clr pD.C
clr pD.D
setb pD.<
clr pD.<
ret
display*
acall ready
mo p0,a
setb pD,C
clr pD.D
setbpD.<
clr pD.<
ret
ready*
clr pD.<
mo p0,O6$$h
clr pD.C
setb pD.D
wait*
clr pD.<
setb pD.<
Qb p0.=,wait
clr pD.<
ret
end
(&periment =* Inter$acing o$ Matri& Bey board microcontroller ?690
#bQectie*
!he purpose o$ this e&periment is to use a matri& key board and the
corresponding character on the L(D display.
Circuit*
!he Matri& keyboard circuit is shown in the 3igure. 2ere we are using the
keyboard o$ <&< Beys.
2ere "ows are connected with +D and Columns are connected with +C as
shown in the $igure.
Led display is connected with +0 o$ the microcontroller. !he matri&
keyboard is inter$aced by using the scanning technology. 2ere we doning
this by so$tware.
3low Chart*
!he $low chart is shown in the below. 3irst we are sending a de$ault
display oer to the L(D display which is simple A@A. !hen we are going to
check whether any key is pressed or notV I$ is so then we are waiting until
any one o$ the key is pressed. !he $irst loop is $or this purpose.
In second loop we are going to check whether any key is pressed or not
here we wait until any key is pressed. 3or this we hae to send A64 at
eery row and check the status o$ the +C.D@+C.6 lines. I$ these then are at
logic 2I'2 then it means that no any key is pressed otherwise i$ any key
is pressed then we identi$y the pressed key. 3or that we start scanning
each row. /e serially make "ows to leel 6 by making other 0.(&*@ we
will send 3(2 at +0 then "ow 6 become L#/ and then will check the
status o$ the +C.D@+C.6 lines,
I$ +C.656 *i.e. Bey6 is pressed
I$ +C.056 *i.e. Bey0 is pressed
I$ +C.C56 *i.e. BeyC is pressed
I$ +C.D56 *i.e. BeyD is pressed
And i$ all lines are at 0, this means that no any key is pressed then we
send 3D2 at the "#/S, so that "#/C will become L#/, and scan each
column. .y this we can get to know about the status o$ key< to key =and
so on.
!he +rogramme*
L Coding 3or Matri& key board Inter$acing
DA!A (J, +0
#"' 66662
M#V +C, O6332 L con$iguring input
M#V DA!A,O3D2 Lde$ault display
M#V +D, O6362
L##+*
M#V A, +C "ead keys
#"L A O632
CN7(,A, O6332,L##+
L /AI! ,7!ILL ,S(" D# 7#! +"(SS !2( B(M
/AI!*
M#V A, +C "ead keys
#"L A, O6362
CN7( A, O6332,7(F!
SNM+ /AI!
7(F!*
ACALL D(LA!C6M
M#V A, +C "ead keys
#"L A, O6362
CN7( A, O6332, 7(F!0
SNM+ /AI!
7(F!0*
M#V +D,O 00000006.
M#V A, +C
#"L A, O6362
CN7( A, O6332, "#/0
M#V +D,O00000060.
M#V A,+C
#"L A, O6$62
CN7( A, O6332, "#/C
M#V +D,O00000600.
M#V A, +C
#"L A, O6362
CN7( A, O6332, "#/D
ANM+ "#/<
L scanning o$ row 0
"#/0*
N. ACC.6, SB(M0
M#V DA!A, O7#6
ANM+ L##+
SB(M0*
N. ACC.0, SB(MC
M#V DA!A, O7#0
ANM+ L##+
SB(MC*
N. ACC.C, SB(MD
M#V DA!A,O7#C
ANM+ L##+
SB(MD*
M#V DA!A, O7#D
ANM+ L##+
L scanning o$ row C
N. ACC.6 SB(M9
M#V DA!A, O7#<
ANM+ L##+
SB(M9*
N. ACC.0 SB(M1
M#V DA!A, O7#9
ANM+ L##+
SB(M1*
N. ACC.C, SB(M=
M#V DA!A, O7#1
ANM+ L##+
SB(M=*
M#V DA!A, O7#=
ANM+ L##+
Lscanning o$ rowD
N. ACC.6,SB(ME
M#V DA!A, O7#?
ANM+ L##+
SB(ME*
N. ACC.0,SB(MA
M#V DA!A, O7#E
ANM+ L##+
SB(MA*
N. ACC.C,SB(M.
M#V DA!A,O7#A
ANM+ L##+
SB(M.*
M#V DA!A, O7#.
ALM+ L##+
L scanning o$ row <
N. ACC.6 SB(MD
M#V DA!A, O7#C
ANM+ L##+
SB(MD*
N. ACC.0 SB(M(
M#V DA!A, O7#D
ANM+ L##+
SB(M(*
N. ACC.C, SB(M3
M#V DA!A, O7#(
ANM+ L##+
SB(M3*
M#V DA!A, O7#3
ANM+ L##+

Das könnte Ihnen auch gefallen