LCD Display 16x2 Command and Data Table
LCD Display 16x2 Command and Data Table
COMMAND TABLE:
1. Clear Display: 0x01
o Clears the display and sets DDRAM (Display Data RAM) address to 0.
2. Return Home: 0x02
o Returns the cursor to the home position (0,0). Also resets the display shift.
3. Entry Mode Set: 0x04
o Sets the cursor move direction and specifies whether to shift the display. Bit
options can be combined:
▪ 0x04: Increment cursor (left to right).
▪ 0x02: Shift display (scrolls entire display).
▪ 0x01: Shift cursor (scrolls cursor position).
4. Display On/Off Control: 0x08
o Controls display and cursor:
▪ 0x08: Display off.
▪ 0x04: Cursor off.
▪ 0x02: Cursor blink off.
5. Cursor or Display Shift: 0x10
o Shifts the cursor or shifts the entire display. Bit options can be combined:
▪ 0x10: Shifts cursor position.
▪ 0x08: Shifts display (shifts entire display left or right).
6. Function Set: 0x20
o Sets interface data length (DL), number of display lines (N), and character font
(F). Bit options can be combined:
▪ 0x20: 4-bit interface, 1 line, 5x8 dots font.
▪ 0x28: 4-bit interface, 2 lines, 5x8 dots font.
▪ 0x30: 8-bit interface, 1 line, 5x8 dots font.
▪ 0x38: 8-bit interface, 2 lines, 5x8 dots font.
7. Set CGRAM Address: 0x40
o Sets CGRAM (Character Generator RAM) address. Allows defining custom
characters. Address range: 0x40 to 0x7F.
8. Set DDRAM Address: 0x80 to 0x9F
o Sets DDRAM (Display Data RAM) address for writing characters. DDRAM
address range depends on the display size and number of lines.
These hexadecimal values correspond to specific commands that you send to the LCD controller
to control various aspects of the display, such as clearing the screen, setting cursor positions,
turning the display on or off, and defining custom characters.
Remember, the exact behavior and available commands can vary slightly depending on the
specific LCD module and controller used. Always refer to the datasheet of your LCD module
DATA TABLE:
1. ASCII Characters (0x20 to 0x7F):
o Space ( ): 0x20
o Numbers (0-9): 0x30 to 0x39
o Uppercase letters (A-Z): 0x41 to 0x5A
o Lowercase letters (a-z): 0x61 to 0x7A
o Special characters like punctuation marks and symbols.
2. Custom Characters:
o You can define up to 8 custom characters (using CGRAM - Character Generator
RAM) with their own hexadecimal values (0x00 to 0x07).
Here are a few examples of custom character patterns (hexadecimal values) commonly used on a
16x2 LCD:
• Heart symbol: 0x0E, 0x1F, 0x1F, 0x0E, 0x04, 0x0A, 0x11, 0x00
• Smiley face: 0x00, 0x0A, 0x00, 0x11, 0x0E, 0x15, 0x0E, 0x00
• Arrow pointing right: 0x04, 0x02, 0x01, 0x1F, 0x01, 0x02, 0x04, 0x00
These values correspond to the binary pattern of dots (pixels) that form each character or symbol
on the LCD. Each byte (8 bits) represents a row of pixels for a character.