You are on page 1of 19

Chapter 5

LCD Interfacing

By DeccanRobots
LCD Interfacing

For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India


LCD Interfacing
RS
LCD Pin RW
Configuration on EN
Interfacing Board
D0

Data Port

D7
VCC for Backlight

GND for Backlight

For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India


Application 1.5
LCD Interfacing
 Refer circuit diagram from book
 You will find a resistance and a preset
connected to pin number 3 of LCD. Use
this preset to control character intensity.
 These connections are already made on
PCB.
 You simply have to connect Pin 4,5,6
and 7 to 14 to 89S52.
For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India
Application 1.5
LCD Interfacing
 DO NOT Connect Pin 15 and 16 to VCC
and Gnd as it may sink more current will
damage power supply IC 7805
assembled on Interfacing board.

For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India


Application 1.5
LCD Interfacing
 EN (Enable) line is used to inform LCD
that data is ready on data port (Pin 7 to
14 of LCD) and LCD can process.

For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India


Application 1.5
LCD Interfacing
 RS (Register Select)
 When RS is LOW (0) then Data on Data
Port ( Pin 7 to 14 of LCD) will be treated
as special instruction.
 When RS is HIGH (1) then Data on
Data Port( Pin 7 to 14 of LCD) will be
treated as text value to be displayed on
LCD.

For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India


Application 1.5
LCD Interfacing
 LCD requires certain commands to
function properly.
 E.g. Character size to be displayed, one
line or two lines, clearing display etc
 These command values are in binary
format.

For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India


Application 1.5
LCD Interfacing
 RW (Read / Write) Line:
 If RW is LOW(0) then Data will be
written to LCD
 IF RW is High(1) then Data will be read
(queried) from LCD

For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India


Application 1.5
LCD Interfacing
 To understand “LCD Interfacing” you
must draw table shown on next slide in
to your notebook.

For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India


These are
Application 1.5 Important
command Values
LCD Interfacing For LCD.

For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India


Application 1.5
LCD Interfacing
Total program is divided in:
EQU Statements
LCALL INIT_LCD
LCALL CLEAR_LCD
LJMP WRITE_TEXT
INIT_LCD:


RET
CLEAR_LCD:


RET
WAIT_LCD:


..
RET
WRITE_TEXT:
For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India
Application 1.5
LCD Interfacing
INIT_LCD is used to configure LCD

CLEAR_LCD is used to clear contents.

WAIT_LCD is used to understand if LCD is free


to process next character or not.

WRITE_TEXT is used to write character to LCD


For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India
Application 1.5
LCD Interfacing
EQU statement is used to create Nick
Name to port pins
EN EQU P3.7
This statement mean P3.7 is named as
EN.
Due to this we can use SETB EN
command which is same as SETB P3.7

For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India


Application 1.5
LCD Interfacing
 EQU statement simplifies code writing
and we need not to remember port pins
everytime.

For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India


Application 1.5
LCD Interfacing
 Make connection as specified in book.
 Write code and download
 You must see “Deccancode” word on
LCD.
 If you find BLACK SQUARES or nothing
then check your connections or code.

For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India


Application 1.5
LCD Interfacing
What is LCALL? (Study this sample code)
LCALL OK
MOV P2,#33h Jump to Label
MOV P3,#44h
OK: Other Similar
SETB 00h command is ACALL

CLR C
RET Go back to Next line from
where call is made
For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India
LCD Interfacing
By this chapter You can:
Control LED using Switch, Control
Stepper Motor and Interface LCD

Commands you have learnt till now:


MOV SETB CLR CPL JB JNB SJMP ANL
ORL RR RL RRC RLC LCALL ACALL LJMP
AJMP
For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India
End of Chapter 5

 This is END of 5th Chapter


 Open 6th Chapter to learn Timer and
Counter

For Microcontroller Development Boards --- www.EmbeddedMarket.com -- India

You might also like