Embedded Interface LCD HD44780

- HD44780 compliant controllers 16×2 Character LCD is a very basic and low-cost LCD module that is commonly used in electronic products and projects.
- 16×2 means it contains 2 rows that can display 16 characters.
- Its other variants such as 16×1 and 16×4 are also available in the market.
LCD4 Bit Mode Functions
- Lcd4_Clear() → Clears the screen
- Display functions (0x0B–0x0E) → Set display, cursor, and blink states
- Shift functions (0x18/0x1C) → Scroll the display left/right
Understanding HD44780 Commands
0x01→ Clear Display0x0B→ Display OFF, Blink ON, Cursor ON0x0C→ Display ON, Blink OFF, Cursor OFF0x0D→ Display ON, Blink OFF, Cursor ON0x0E→ Display ON, Blink ON, Cursor OFF0x08,0x0C,0x18,0x1C→ Cursor or display shift commands
Commands are sent using a function like Lcd4_Cmd() in 4-bit mode, which splits each byte into two nibbles for transmission.
Function Explanation
a) Clear Screen
void Lcd4_Clear() {
Lcd4_Cmd(0x00);
Lcd4_Cmd(0x01);
}
0x01clears the display and sets the cursor at the home position.- The first
0x00is likely a control prefix for 4-bit mode.
b) Display Modes
void Lcd4_DisplayOFF_BlinkON_CursorON() {
Lcd4_Cmd(0x00);
Lcd4_Cmd(0x0B);
}
- Turns display off, enables blinking cursor, and sets cursor visible.
void Lcd4_DisplayON_BlinkOFF_CursorOFF() {
Lcd4_Cmd(0x00);
Lcd4_Cmd(0x0C);
}
- Turns display on, disables blinking, hides the cursor.
void Lcd4_DisplayON_BlinkOFF_CursorON() {
Lcd4_Cmd(0x00);
Lcd4_Cmd(0x0D);
}
- Display ON, blinking OFF, cursor visible.
void Lcd4_DisplayON_BlinkON_CursorOFF() {
Lcd4_Cmd(0x00);
Lcd4_Cmd(0x0E);
}
- Display ON, blinking ON, cursor hidden.
c) Shift Commands (Commented Out)
// void Lcd4_Shift_Left() { Lcd4_Cmd(0x01); Lcd4_Cmd(0x08); }
// void Lcd4_Shift_Right() { Lcd4_Cmd(0x01); Lcd4_Cmd(0x0C); }
0x18→ Shift display left0x1C→ Shift display right
How It Works
Lcd4_Cmd()sends commands to the LCD. In 4-bit mode, each byte is split into upper and lower nibble.- Functions like
Lcd4_Clear()orLcd4_DisplayON_BlinkOFF_CursorON()wrap these commands for easier use in code. - By calling these functions, you can control display on/off, cursor visibility, blinking, and clear or shift the display.