Beruflich Dokumente
Kultur Dokumente
►Introduction
The most commonly used Character based LCDs are based on Hitachi's HD44780
controller or other which are compatible with HD44580. In this tutorial, we will discuss
about character based LCDs, their interfacing with various microcontrollers, various
interfaces (8-bit/4-bit), programming, special stuff and tricks you can do with these
simple looking LCDs which can give a new look to your application.
►Pin Description
The most commonly used LCDs found in the market today are 1 Line, 2 Line or 4 Line
LCDs which have only 1 controller and support at most of 80 charachers, whereas LCDs
supporting more than 80 characters make use of 2 HD44780 controllers.
Most LCDs with 1 controller has 14 Pins and LCDs with 2 controller has 16 Pins (two
pins are extra in both for back-light LED connections). Pin description is shown in the
table below.
Usually these days you will find single controller LCD modules are used more in the
market. So in the tutorial we will discuss more about the single controller LCD, the
operation and everything else is same for the double controller too. Lets take a look at the
basic information which is there in every LCD.
►LCD Initialization
Before using the LCD for display purpose, LCD has to be initialized either by the internal
reset circuit or sending set of commands to initialize the LCD. It is the user who has to
decide whether an LCD has to be initialized by instructions or by internal reset circuit. we
will dicuss both ways of initialization one by one.
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.
Display clear
Function set:
DL = 1; 8-bit interface data
N = 0; 1-line display
F = 0; 5 x 8 dot character font
Display on/off control:
D = 0; Display off
C = 0; Cursor off
B = 0; Blinking off
Entry mode set:
I/D = 1; Increment by 1
S = 0; No shift
Note: If the electrical characteristics conditions listed under the table Power Supply
Conditions Using Internal Reset Circuit are not met, the internal reset circuit will not
operate normally and will fail to initialize the HD44780U. For such a case, initial-ization
must be performed by the MCU as explained in the section, Initializing by Instruction.
As mentioned in the Note, there are certain condtions that has to be met, if user want to
use initialization by internal reset circuit. These conditions are shown in the Table 5
below.
Figure 7 shows the test condition which are to be met for internal reset circuit to be
active.
Figure 7: Internal Power Supply reset
Now the problem with the internal reset circuit is, it is highly dependent on power supply,
to meet this critical power supply conditions is not hard but are difficult to achive when
you are making a simple application. So usually the second menthod i.e. Initialization by
instruction is used and is recommended most of the time.
Initialization by instructions
Initializing LCD with instructions is really simple. Given below is a flowchart that
describles the step to follow, to initialize the LCD.
Figure 8: Flow chart for LCD initialization
As you can see from the flow chart, the LCD is initialized in the following sequence...
1) Send command 0x30 - Using 8-bit interface
2) Delay 20ms
3) Send command 0x30 - 8-bit interface
4) Delay 20ms
5) Send command 0x30 - 8-bit interface
6) Delay 20ms
7) Send Function set - see Table 4 for more information
8) Display Clear command
9) Set entry mode command - explained below
The first 3 commands are usually not required but are recomended when you are using
4-bit interface. So you can program the LCD starting from step 7 when working with
8-bit interface. Function set command depends on what kind of LCD you are using
and what kind of interface you are using (see Table 4 in LCD Command section).