Initialization

Modules with Hitachi controllers will properly self-initialize if Vcc rises from 0 to 4.5v in a period between 0.1 mS and 10 mS. This is difficult to guarantee, so manual initialization is required in most applications. If you do use auto-initialization, it will come up in this mode: 8-bit interface, 1/8 duty cycle (1 line mode), 5x7 font, cursor increment right, no shift. On most displays, you want to switch to 1/16 duty cycle (2 line mode) because for all but the 20x1, there are two logical lines as the controller sees it. If you have an 5x11-size character dot matrix module, you'll want to switch to the 5x10 font as well (the 11th line is the cursor).


Initialization for 8-bit Operation

<POWER ON>

<Wait 15ms>

RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
0   0   0   0   1   1   x   x   x   x    x=don't care

<Wait 4.1ms>

RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
0   0   0   0   1   1   x   x   x   x

<Wait 100us>

RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
0   0   0   0   1   1   x   x   x   x

<Wait 4.1ms>

RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
0   0   0   0   1   1   N   F   x   x    8-bit operation
                                         N=Number of `lines'
					   0 for 1/8 duty cycle -- 1 `line'
					   1 for 1/16 duty cycle -- 2 `lines'
                                         F=font, 
                                           1 for 5x11 dot matrix
                                           0 for 5x8 dot matrix

<Wait 40us or till BF=0>

RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
0   0   0   0   0   0   1   0   0   0    Display off, 
                                         cursor off,
                                         blink off

<Wait 40us or till BF=0>

RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
0   0   0   0   0   0   0   0   0   1    Clear screen, 
                                         cursor home

<Wait 1.64ms or till BF=0>

RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
0   0   0   0   0   0   0   1   1   0    Increment cursor to 
                                         the right when writing,
                                         don't shift screen

<Wait 40us or till BF=0>

<INITIALIZATION COMPLETE>

NOTE: Remember to turn the display back on and set up the cursor as desired with a Display On/Off control command.


Initialization for 4-bit operation

The module powers up in 8-bit mode. The initial startup instructions are sent in 8-bit mode, with the lower four bits (which are not connected) of each instruction as don't cares.

After the fourth instruction, which switches the module to 4-bit operation, the control bytes are sent on consecutive enable cycles (no delay is required between nibbles). The most significant nibble is sent first, followed immediately by the least significant nibble.

<POWER ON>

<Wait at least 15ms>

RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 
0   0   0   0   1   1  n/c n/c n/c n/c  

<Wait at least 4.1ms>

RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 
0   0   0   0   1   1  n/c n/c n/c n/c 

<Wait at least 100us>

RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 
0   0   0   0   1   1  n/c n/c n/c n/c 

<Wait 4.1ms>

RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 
0   0   0   0   1   0  n/c n/c n/c n/c   4-bit operation
                                         From now on all transfers
					 must take place in pairs,
					 1 nibble at a time.

The remainder of the initialization sequence could be carried out by issuing calls to an LCDWriteCommand subroutine which would wait for BF to become 0 and then send the two nibbles making up the command byte.

<Wait 40us or till BF=0>

RS R/W DB7 DB6 DB5 DB4 
0   0   0   0   1   0
                        
0   0   N   F   x   x   N=Number of `lines'
			  0 for 1/8 duty cycle -- 1 `line'
			  1 for 1/16 duty cycle -- 2 `lines'
                        F=font
			  1 for 5x11 dot matrix
                          0 for 5x8 dot matrix
                        x=don't care

<Wait 40us or till BF=0>

RS R/W DB7 DB6 DB5 DB4 
0   0   0   0   0   0   

0   0   1   0   0   0    Display off, cursor off, blink off

<Wait 40us or till BF=0>

RS R/W DB7 DB6 DB5 DB4
0   0   0   0   0   0   

0   0   0   0   0   1    Clear screen, cursor home

<Wait 1.64ms or till BF=0>

RS R/W DB7 DB6 DB5 DB4 
0   0   0   0   0   0   

0   0   0   1   1   0    Increment cursor to the right
                         when writing, don't shift screen

<Wait 40us or till BF=0>

<INITIALIZATION COMPLETE>

NOTE: Remember to turn the display back on and set up the cursor as desired with a Display On/Off control command.