6.5 LCD Initialisation
The LCD controller has to be initialised before it can be used. The initialisation sequence is different when the LCD is operated in 4-bit or 8-bit mode. Although the 4-bit mode is more commonly used, we will look at the initialisation of the LCD when operated in both modes.
6.5.1 8-bit Mode Initialisation
The steps to initialise the LCD in 8-bit mode are as follows:
1. Wait at least 15 ms after power is applied.
2. Write 0 × 030 to LCD and wait 5 ms for the instruction to complete.
3. Write 0 × 030 to LCD and wait 160 μs for the instruction to complete.
4. Write 0 × 030 to LCD and wait 160 μs for the instruction to complete.
5. Set the operating characteristics of the LCD:
- set interface length (8-bit);
- turn off display;
- turn on display;
- set entry mode.
6.5.2 4-bit Mode Initialisation
The steps to initialise the LCD in 4-bit mode are
1. Wait at least 15 ms after power is applied.
2. Write 0 × 03 to LCD and wait 5 ms for the instruction to complete.
3. Write 0 × 03 to LCD and wait 160 μs for the instruction to complete.
4. Write 0 × 030 to LCD and wait 160 μs for the instruction to complete.
5. Set the operating characteristics of the LCD:
- Write 0 × 02 to set 4-bit mode.
Following instructions/data writes must be in two nibbles
- Set interface length and font.
- Turn off display.
- Turn on display and enable blink cursor.
- Set entry mode.
In most LCD based projects, the 4-bit mode is used. Considering only the 4-bit mode of operation with 5 × ...