Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
|
Introduction to LCD:
ð
Bi-directional data/command pins.
Alphanumeric characters are sent in ASCII format.
RS = 0 -> Command Register is selected
RS = 1 -> Data Register is selected
0 -> Write, 1 -> Read
Used to latch the data present on the data pins.
A high-to-low edge is needed to latch the data.
ß
ã
ã !"# !" !
$
ã %
&
'
ã ( &
'
44780 BACKGROUND
@
If you have sufficient data lines you can go for 8 bit
data bus & if there is a time constrain i.e. display
should be faster then we have to use 8-bit data bus
because basically 4-bit data bus takes twice as more
time as compared to 8-bit data bus.
UNDERSTANDING LCD
Registers:
Busy Flag:
When the busy flag is "1", the HD44780 is in the internal operation mode,
and the next instruction will not be accepted.
As the Register selection table below shows, the busy flag is output to DB7
when RS = 0 and R/W = 1. The next instruction must be written after
ensuring that the busy flag is "0".
UNDERSTANDING LCD(contd.)
In the above memory map, the area shaded in black is the visible
display (For 16x2 display) .
For first line addresses for first 15 characters is from 00h to 0Fh.
But for second line address of first character is 40h and so on
up to 4Fh for the 16th character.
So if you want to display the text at specific positions of LCD ,
we require to manipulate address and then to set cursor
position accordingly .
UNDERSTANDING LCD(contd.)
As you can see, a 1-to-1 relation has been established between a pin on the
8051 and a line on the 44780 LCD. Thus as we write our assembly program
to access the LCD, we are going to equate constants to the 8051 ports so
that we can refer to the lines by their 44780 name as opposed to ß0.1, ß0.2,
etc.
DB0 EQU ß1.0
DB1 EQU ß1.1
DB2 EQU ß1.2
DB3 EQU ß1.3
DB4 EQU ß1.4
DB5 EQU ß1.5
DB6 EQU ß1.6
DB7 EQU ß1.7
E EQU ß3.7
RS EQU ß3.6
RW EQU ß3.5
DATA EQU ß1
INITIALIZING THE LCD
Before you may really use the LCD, you must initialize and
configure it. This is accomplished by sending a number
of initialization instructions to the LCD.
|
VV
|V
| ||@|
(The LCD command 38h is really the sum of a number of
option bits. The instruction itself is the instruction 20h
("Function set"). However, to this we add the values 10h
to indicate an 8-bit data bus plus 08h to indicate that the
display is a two-line display.)
INITIALIZING THE LCD(contd.)
|
V
VV
|V
| ||@|
When the LCD is first initialized, the screen should automatically be cleared by
the 44780 controller.
An LCD command exists to accomplish this function and since we will wish to
execute this operation more than once, it's a good idea to make it a subroutine:
|V|
|
VV
|V
| ||@|
V
With the "Clear Screen" routine, we may clear the LCD at any time by simply
executing an LCALL CLEAR_LCD.
(Executing the "Clear Screen" instruction on the LCD also positions the cursor in
the upper left-hand corner as we would expect.)
WRITING TEXT TO THE LCD
Now we get to the real meat of what we're trying to do: All this effort is really so
we can display text on the LCD. Really, we're pretty much done.
Once again, writing text to the LCD is something we'll almost certainly want to do
over and over--so we¶ll make it a subroutine.
@VV
V
VV
|V
| ||@|
V
The WRITE_TEXT routine will send the character in the accumulator to the LCD
which will, in turn, display it. Thus to display text on the LCD all we need to do
is load the accumulator with the byte to display and make a call to this routine.
A "HELLO WORLD" ßROGRAM
Now that we have all the component subroutines written, writing the classic "Hello World"
program--which displays the text "Hello World" on the LCD is a relatively trivial matter.
Consider:
| ||@ @|
| || |V|
!"!
| ||@VV
!V!
| ||@VV
!|!
| ||@VV
!|!
| ||@VV
!!
| ||@VV
!'
A "HELLO WORLD" ßROGRAM(contd.)
| ||@VV
!!
| ||@VV
!!
| ||@VV
!!
| ||@VV
!|!
| ||@VV
!!
| ||@VV
The above "Hello World" program should, when executed, initialize
the LCD, clear the LCD screen, and display "Hello World" in the
upper left-hand corner of the display.
CURSOR ßOSITIONING
In the above memory map, the area shaded in blue is the visible
display. As you can see, it measures 16 characters per line by 2
lines. The numbers in each box is the memory address that
corresponds to that screen position.
Thus, the first character in the upper left-hanad corner is at
address 00h. The following character position (character #2
on the first line) is address 01h, etc. This continues until we
reach the 16th character of the first line which is at address
0Fh.
CURSOR ßOSITIONING(contd.)
|
VV
|V
| ||@|
The above code will position the cursor on line 2, character
10. To display "Hello" in the upper left-hand corner with
the word "World" on the second line at character position
10 just requires us to insert the above code into our
existing "Hello World" program.
CURSOR ßOSITIONING(contd.)
a |V @
Wipe gently with cotton or soft material soaked in petroleum benzine.
Do not use acetone, toluene, ethanol or isopropyl alcohol.
Contact with water for a long period of time may damage the display.
a #V$
The toxicity of liquid crystal fluid is very low, but wash it off immediately
with soap and water if fluid touches the skin or clothing.
a " |@
Do not touch display area with bare hands.
Do not touch exposed polarizer with hard objects.
Do not expose the CMOS IC¶s to static electricity.
Avoid exposing the module to excessive shock or pressure.
Do not allow the storage temperature to exceed the specified range.
"VV
GUIDED BY-
Brig(Retd) S ß Ghrera
H.O.D(CS AND IT DEßTT.)
SUBMITTED BY:
ANMOL VERMA(081022)
SNEH SRIJAN (081045)