Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 25

Liquid Crystal Display (LCD)

HD44780u character LCD


What type of LCD?
About 44780
• The 44780 standard requires 3 control lines as well as either 4
or 8 I/O lines for the data bus.
– The three control lines are: E, RS, and RW
• The user can select whether the LCD is to operate with a 4-bit
data bus or an 8-bit data bus.
– If a 4-bit interface is used, the LCD will require a total of 7
pins/lines (3 control lines + 4 lines for the data bus).
– If an 8-bit interface is used the LCD will require a total of 11
pins/lines (3 control lines + 8 lines for the data bus).
About Character LCD

• The most common LCDs are 16x2 and 20x2 displays


– 16x2 - 16 characters per line and 2 lines
– 20x2 - 20 characters per line and 2 lines
– 20x4 - 20 characters per line and 4 lines
• HD44780U is the de-facto product for character LCD.
• Vast majority of manufacturers produce LCDs that
are compatible with this product.
Cursor Positioning

• The area shaded in blue is the visible display.


• There are 16 characters per line by 2 lines.
• The numbers in each box is the memory
address that corresponds to that screen
position.
Example

• The first character in the upper left-hand corner is at


address 00h. The following character position is address
01h, etc.
• This continues until we reach the 16th character of the
first line which is at address 0Fh.
• If we write a character to the last position of the first
line and then write a second character, the second
character will not appear on the second line.
• You should force cursor to the beginning of the 2nd line.
Schematic (4-bit interface)
• (DB4, DB5, DB6, and DB7) are used for data

Source: MCB2300-schematic.pdf
Control Line: Enable
• The E line is called "Enable“.
• The E line is used to start data read/write

• The E line must be raised/lowered


before/after each instruction sent to the LCD
regardless of whether that instruction is read
or write, text or instruction. If you never bring
E low, your instruction will never be executed.
Control Line: Register Select

• The RS line is the "Register Select" line.


• When RS is low (0)
– the data on the data lines is to be treated as a
command or a special instruction (such as clear
screen, position cursor, etc.).
• When RS is high (1)
– the data being sent is a character which should be
displayed on the screen.
Control Line: Read/Write
• The R/W line is the "Read/Write" control line.
• When R/W is low (0), the information on the data
bus is being written to the LCD.
• When R/W is high (1), the program is effectively
querying (or reading) the LCD.
• Only one instruction ("Get LCD status") is a read
command. All others are write commands, R/W will
almost always be low.
Initializing the LCD
• Before you can really use the LCD, you must initialize and configure it.
– This is accomplished by sending a number of initialization instructions to the LCD.
• An internal reset circuit automatically initializes the HD44780U when the power is turned
on.
• The following instructions are executed during the initialization.
– The busy flag (BF) is kept in the busy state until the initialization ends (BF = 1).
– The busy state lasts for 10 ms after VCC rises to 4.5 V.
1. Display clear
2. Function set:
DL = 1 ; 8-bit interface data
N = 0 ; 1-line display
F = 0 ; 5 x 8 dot character font
3. Display on/off control:
D = 0 ; Display off
C = 0 ; Cursor off
B = 0 ; Blinking off
4. Entry mode set:
I/D = 1 ; Increment by 1 (I/D  Increment/Decrement)
S = 0 ; No shift
Two approaches

1. Not checking Busy Flag at all


– Estimate the processing time of LCD
– Creates a time delay that’s long enough so that LCD can
receive all of the commands and data.
– However, this approach is not flexible. If more than one
supplier is used in the product line, the software may not
work for all platforms.
Source: HD44780u manual
Source: HD44780u manual
Two approaches

2. Check busy flag


– Flexible
– Can get the fastest display time out of the LCD
– Works with any compatible LCD without “tuning” the
software
Checking the Busy Flag

To check the state of the busy flag and read the


address counter
– Set R/W Pin of the LCD (to read from the LCD)
– Select the instruction register by clearing RS pin
– Enable the LCD by setting the enable E pin
– The most significant bit of the LCD data bus (DB7) is the
state of the busy flag (1=Busy,0=ready to accept
instructions/data). The other bits hold the current value of
the address counter.
What is Busy Flag?

• It takes a certain amount of time for each


instruction to be executed by the LCD.
• The delay varies depending on the frequency of
the crystal attached to the oscillator input of the
HD44780 as well as the instruction which is being
executed.
• When an instruction is being executed for internal
operation, no instruction other than the busy
flag/address read instruction can be executed.
Busy Flag

• When the busy flag is 1


– the HD44780U is in the internal
operation mode, and the next instruction will not
be accepted.
• When RS = 0 and R/W = 1, the busy flag is
output to DB7.
– Check it to make sure it is 0 before sending in
another instruction.
Busy Flag check timing sequence
8-bit interface

Source: HD44780u manual


4-bit interface

Source: MCB2300-schematic.pdf
4-bit interface
• 8-bit data is constructed by sending 4-bit data twice.
• Four high order bits (for 8-bit operation, DB4 to DB7)
are transferred before the four low order bits.
4-bit interface

Source: HD44780u manual


LCM-S01602DSR/B
Source: http://www.lumex.com/specs/LCM-S01602DSR%20B.pdf

You might also like