You are on page 1of 1

Initialization:

The LCD can be configured in 4-bit mode by sending appropriate instruction which is
called Function set to it. The Function set is hexadecimal instruction for LCD MPU
unit, which selects working modes of LCD. The Function Set is mentioned in following
table:

Description:
DL - Data Length (DL = 1 8bit, DL = 0 4bit)
N - No. of Lines (N = 1 2Lines, N = 0 1Lines)
F - Fonts (F = 1 5x10 dots, F = 0 5x7 dots)

According to table, the value of Function Set for 4 bit mode will be 0010 0000(0x20)
because DL=0. The value Function Set for the LCD configuration 2 line (N=1), 5X7
dots (F=0) and 4-bit (DL=0) mode will be 0010 1000(0x28).

When the power supply is given to LCD, it remains in 8-bit mode. Now, if 0x20 is sent,
lower nibble will not be received by LCD because four data lines (D4-D7) are
connected, so 0x02 is sent instead of 0x20.

Programming Steps:
Step1: Initialization of 4-bit mode.

void lcd_init() // fuction for intialize


{
LCD_cmd(0x02); // to initialize LCD in 4-bit mode.
LCD_cmd(0x28); //to initialize LCD in 2 lines, 5X7 dots and 4bit mode.
}

You might also like